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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 DCHECK(!init_cb_.is_null()); | 220 DCHECK(!init_cb_.is_null()); |
221 DCHECK(read_cb_.is_null()); | 221 DCHECK(read_cb_.is_null()); |
222 DCHECK(reset_cb_.is_null()); | 222 DCHECK(reset_cb_.is_null()); |
223 | 223 |
224 decoder_selector_.reset(); | 224 decoder_selector_.reset(); |
225 if (decrypting_demuxer_stream) | 225 if (decrypting_demuxer_stream) |
226 stream_ = decrypting_demuxer_stream.get(); | 226 stream_ = decrypting_demuxer_stream.get(); |
227 | 227 |
228 if (!selected_decoder) { | 228 if (!selected_decoder) { |
229 state_ = STATE_UNINITIALIZED; | 229 state_ = STATE_UNINITIALIZED; |
230 StreamTraits::FinishInitialization( | 230 base::ResetAndReturn(&init_cb_).Run(false); |
231 base::ResetAndReturn(&init_cb_), selected_decoder.get(), stream_); | |
232 return; | 231 return; |
233 } | 232 } |
234 | 233 |
235 state_ = STATE_NORMAL; | 234 state_ = STATE_NORMAL; |
236 decoder_ = selected_decoder.Pass(); | 235 decoder_ = selected_decoder.Pass(); |
237 decrypting_demuxer_stream_ = decrypting_demuxer_stream.Pass(); | 236 decrypting_demuxer_stream_ = decrypting_demuxer_stream.Pass(); |
238 StreamTraits::FinishInitialization( | 237 |
239 base::ResetAndReturn(&init_cb_), decoder_.get(), stream_); | 238 if (StreamTraits::NeedsBitstreamConversion(decoder_.get())) |
| 239 stream_->EnableBitstreamConverter(); |
| 240 base::ResetAndReturn(&init_cb_).Run(true); |
240 } | 241 } |
241 | 242 |
242 template <DemuxerStream::Type StreamType> | 243 template <DemuxerStream::Type StreamType> |
243 void DecoderStream<StreamType>::SatisfyRead( | 244 void DecoderStream<StreamType>::SatisfyRead( |
244 Status status, | 245 Status status, |
245 const scoped_refptr<Output>& output) { | 246 const scoped_refptr<Output>& output) { |
246 DCHECK(!read_cb_.is_null()); | 247 DCHECK(!read_cb_.is_null()); |
247 base::ResetAndReturn(&read_cb_).Run(status, output); | 248 base::ResetAndReturn(&read_cb_).Run(status, output); |
248 } | 249 } |
249 | 250 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 532 } |
532 | 533 |
533 // The resetting process will be continued in OnDecoderReinitialized(). | 534 // The resetting process will be continued in OnDecoderReinitialized(). |
534 ReinitializeDecoder(); | 535 ReinitializeDecoder(); |
535 } | 536 } |
536 | 537 |
537 template class DecoderStream<DemuxerStream::VIDEO>; | 538 template class DecoderStream<DemuxerStream::VIDEO>; |
538 template class DecoderStream<DemuxerStream::AUDIO>; | 539 template class DecoderStream<DemuxerStream::AUDIO>; |
539 | 540 |
540 } // namespace media | 541 } // namespace media |
OLD | NEW |