OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/filters/decoder_stream.h" | 5 #include "media/filters/decoder_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 | 35 |
36 template <> | 36 template <> |
37 const char* GetTraceString<DemuxerStream::AUDIO>() { | 37 const char* GetTraceString<DemuxerStream::AUDIO>() { |
38 return "DecoderStream<AUDIO>::Decode"; | 38 return "DecoderStream<AUDIO>::Decode"; |
39 } | 39 } |
40 | 40 |
41 template <DemuxerStream::Type StreamType> | 41 template <DemuxerStream::Type StreamType> |
42 DecoderStream<StreamType>::DecoderStream( | 42 DecoderStream<StreamType>::DecoderStream( |
43 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 43 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
44 ScopedVector<Decoder> decoders, | 44 ScopedVector<Decoder> decoders, |
45 const SetDecryptorReadyCB& set_decryptor_ready_cb) | 45 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
46 const scoped_refptr<MediaLog>& media_log) | |
46 : task_runner_(task_runner), | 47 : task_runner_(task_runner), |
48 media_log_(media_log), | |
47 state_(STATE_UNINITIALIZED), | 49 state_(STATE_UNINITIALIZED), |
48 stream_(NULL), | 50 stream_(NULL), |
49 low_delay_(false), | 51 low_delay_(false), |
50 decoder_selector_( | 52 decoder_selector_( |
51 new DecoderSelector<StreamType>(task_runner, | 53 new DecoderSelector<StreamType>(task_runner, |
52 decoders.Pass(), | 54 decoders.Pass(), |
53 set_decryptor_ready_cb)), | 55 set_decryptor_ready_cb)), |
54 active_splice_(false), | 56 active_splice_(false), |
55 decoding_eos_(false), | 57 decoding_eos_(false), |
56 pending_decode_requests_(0), | 58 pending_decode_requests_(0), |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 if (!selected_decoder) { | 231 if (!selected_decoder) { |
230 state_ = STATE_UNINITIALIZED; | 232 state_ = STATE_UNINITIALIZED; |
231 base::ResetAndReturn(&init_cb_).Run(false); | 233 base::ResetAndReturn(&init_cb_).Run(false); |
232 return; | 234 return; |
233 } | 235 } |
234 | 236 |
235 state_ = STATE_NORMAL; | 237 state_ = STATE_NORMAL; |
236 decoder_ = selected_decoder.Pass(); | 238 decoder_ = selected_decoder.Pass(); |
237 decrypting_demuxer_stream_ = decrypting_demuxer_stream.Pass(); | 239 decrypting_demuxer_stream_ = decrypting_demuxer_stream.Pass(); |
238 | 240 |
241 if (decrypting_demuxer_stream_) | |
242 media_log_->SetStringProperty("decrypting_demuxer_stream", "yes"); | |
DaleCurtis
2014/09/08 18:41:39
Always set w/ yes/no ?
xhwang
2014/09/08 20:12:10
Changed to binary property.
| |
243 | |
244 if (StreamType == DemuxerStream::VIDEO) | |
245 media_log_->SetStringProperty("video_decoder", decoder_->GetDisplayName()); | |
246 else if (StreamType == DemuxerStream::AUDIO) | |
247 media_log_->SetStringProperty("audio_decoder", decoder_->GetDisplayName()); | |
248 else | |
249 NOTREACHED(); | |
DaleCurtis
2014/09/08 18:41:39
I take it TEXT type streams never reach this point
xhwang
2014/09/08 20:12:10
Using ToString() now so the check is moved to comp
| |
250 | |
239 if (StreamTraits::NeedsBitstreamConversion(decoder_.get())) | 251 if (StreamTraits::NeedsBitstreamConversion(decoder_.get())) |
240 stream_->EnableBitstreamConverter(); | 252 stream_->EnableBitstreamConverter(); |
241 base::ResetAndReturn(&init_cb_).Run(true); | 253 base::ResetAndReturn(&init_cb_).Run(true); |
242 } | 254 } |
243 | 255 |
244 template <DemuxerStream::Type StreamType> | 256 template <DemuxerStream::Type StreamType> |
245 void DecoderStream<StreamType>::SatisfyRead( | 257 void DecoderStream<StreamType>::SatisfyRead( |
246 Status status, | 258 Status status, |
247 const scoped_refptr<Output>& output) { | 259 const scoped_refptr<Output>& output) { |
248 DCHECK(!read_cb_.is_null()); | 260 DCHECK(!read_cb_.is_null()); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
541 } | 553 } |
542 | 554 |
543 // The resetting process will be continued in OnDecoderReinitialized(). | 555 // The resetting process will be continued in OnDecoderReinitialized(). |
544 ReinitializeDecoder(); | 556 ReinitializeDecoder(); |
545 } | 557 } |
546 | 558 |
547 template class DecoderStream<DemuxerStream::VIDEO>; | 559 template class DecoderStream<DemuxerStream::VIDEO>; |
548 template class DecoderStream<DemuxerStream::AUDIO>; | 560 template class DecoderStream<DemuxerStream::AUDIO>; |
549 | 561 |
550 } // namespace media | 562 } // namespace media |
OLD | NEW |