| 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 const std::string stream_type = DecoderStreamTraits<StreamType>::ToString(); |
| 242 media_log_->SetBooleanProperty((stream_type + "_dds").c_str(), |
| 243 decrypting_demuxer_stream_); |
| 244 media_log_->SetStringProperty((stream_type + "_decoder").c_str(), |
| 245 decoder_->GetDisplayName()); |
| 246 |
| 239 if (StreamTraits::NeedsBitstreamConversion(decoder_.get())) | 247 if (StreamTraits::NeedsBitstreamConversion(decoder_.get())) |
| 240 stream_->EnableBitstreamConverter(); | 248 stream_->EnableBitstreamConverter(); |
| 241 base::ResetAndReturn(&init_cb_).Run(true); | 249 base::ResetAndReturn(&init_cb_).Run(true); |
| 242 } | 250 } |
| 243 | 251 |
| 244 template <DemuxerStream::Type StreamType> | 252 template <DemuxerStream::Type StreamType> |
| 245 void DecoderStream<StreamType>::SatisfyRead( | 253 void DecoderStream<StreamType>::SatisfyRead( |
| 246 Status status, | 254 Status status, |
| 247 const scoped_refptr<Output>& output) { | 255 const scoped_refptr<Output>& output) { |
| 248 DCHECK(!read_cb_.is_null()); | 256 DCHECK(!read_cb_.is_null()); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } | 549 } |
| 542 | 550 |
| 543 // The resetting process will be continued in OnDecoderReinitialized(). | 551 // The resetting process will be continued in OnDecoderReinitialized(). |
| 544 ReinitializeDecoder(); | 552 ReinitializeDecoder(); |
| 545 } | 553 } |
| 546 | 554 |
| 547 template class DecoderStream<DemuxerStream::VIDEO>; | 555 template class DecoderStream<DemuxerStream::VIDEO>; |
| 548 template class DecoderStream<DemuxerStream::AUDIO>; | 556 template class DecoderStream<DemuxerStream::AUDIO>; |
| 549 | 557 |
| 550 } // namespace media | 558 } // namespace media |
| OLD | NEW |