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/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 stream_ = NULL; | 76 stream_ = NULL; |
77 decoder_.reset(); | 77 decoder_.reset(); |
78 decrypting_demuxer_stream_.reset(); | 78 decrypting_demuxer_stream_.reset(); |
79 } | 79 } |
80 | 80 |
81 template <DemuxerStream::Type StreamType> | 81 template <DemuxerStream::Type StreamType> |
82 void DecoderStream<StreamType>::Initialize( | 82 void DecoderStream<StreamType>::Initialize( |
83 DemuxerStream* stream, | 83 DemuxerStream* stream, |
84 const InitCB& init_cb, | 84 const InitCB& init_cb, |
85 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 85 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
86 const StatisticsCB& statistics_cb) { | 86 const StatisticsCB& statistics_cb, |
| 87 const base::Closure& waiting_for_decryption_key_cb) { |
87 FUNCTION_DVLOG(2); | 88 FUNCTION_DVLOG(2); |
88 DCHECK(task_runner_->BelongsToCurrentThread()); | 89 DCHECK(task_runner_->BelongsToCurrentThread()); |
89 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 90 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
90 DCHECK(init_cb_.is_null()); | 91 DCHECK(init_cb_.is_null()); |
91 DCHECK(!init_cb.is_null()); | 92 DCHECK(!init_cb.is_null()); |
92 | 93 |
93 statistics_cb_ = statistics_cb; | 94 statistics_cb_ = statistics_cb; |
94 init_cb_ = init_cb; | 95 init_cb_ = init_cb; |
| 96 waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb; |
95 stream_ = stream; | 97 stream_ = stream; |
96 | 98 |
97 state_ = STATE_INITIALIZING; | 99 state_ = STATE_INITIALIZING; |
98 SelectDecoder(set_decryptor_ready_cb); | 100 SelectDecoder(set_decryptor_ready_cb); |
99 } | 101 } |
100 | 102 |
101 template <DemuxerStream::Type StreamType> | 103 template <DemuxerStream::Type StreamType> |
102 void DecoderStream<StreamType>::Read(const ReadCB& read_cb) { | 104 void DecoderStream<StreamType>::Read(const ReadCB& read_cb) { |
103 FUNCTION_DVLOG(2); | 105 FUNCTION_DVLOG(2); |
104 DCHECK(task_runner_->BelongsToCurrentThread()); | 106 DCHECK(task_runner_->BelongsToCurrentThread()); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 207 } |
206 | 208 |
207 template <DemuxerStream::Type StreamType> | 209 template <DemuxerStream::Type StreamType> |
208 void DecoderStream<StreamType>::SelectDecoder( | 210 void DecoderStream<StreamType>::SelectDecoder( |
209 const SetDecryptorReadyCB& set_decryptor_ready_cb) { | 211 const SetDecryptorReadyCB& set_decryptor_ready_cb) { |
210 decoder_selector_->SelectDecoder( | 212 decoder_selector_->SelectDecoder( |
211 stream_, set_decryptor_ready_cb, | 213 stream_, set_decryptor_ready_cb, |
212 base::Bind(&DecoderStream<StreamType>::OnDecoderSelected, | 214 base::Bind(&DecoderStream<StreamType>::OnDecoderSelected, |
213 weak_factory_.GetWeakPtr()), | 215 weak_factory_.GetWeakPtr()), |
214 base::Bind(&DecoderStream<StreamType>::OnDecodeOutputReady, | 216 base::Bind(&DecoderStream<StreamType>::OnDecodeOutputReady, |
215 weak_factory_.GetWeakPtr())); | 217 weak_factory_.GetWeakPtr()), |
| 218 waiting_for_decryption_key_cb_); |
216 } | 219 } |
217 | 220 |
218 template <DemuxerStream::Type StreamType> | 221 template <DemuxerStream::Type StreamType> |
219 void DecoderStream<StreamType>::OnDecoderSelected( | 222 void DecoderStream<StreamType>::OnDecoderSelected( |
220 scoped_ptr<Decoder> selected_decoder, | 223 scoped_ptr<Decoder> selected_decoder, |
221 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream) { | 224 scoped_ptr<DecryptingDemuxerStream> decrypting_demuxer_stream) { |
222 FUNCTION_DVLOG(2) << ": " | 225 FUNCTION_DVLOG(2) << ": " |
223 << (selected_decoder ? selected_decoder->GetDisplayName() | 226 << (selected_decoder ? selected_decoder->GetDisplayName() |
224 : "No decoder selected."); | 227 : "No decoder selected."); |
225 DCHECK(task_runner_->BelongsToCurrentThread()); | 228 DCHECK(task_runner_->BelongsToCurrentThread()); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 } | 585 } |
583 | 586 |
584 // The resetting process will be continued in OnDecoderReinitialized(). | 587 // The resetting process will be continued in OnDecoderReinitialized(). |
585 ReinitializeDecoder(); | 588 ReinitializeDecoder(); |
586 } | 589 } |
587 | 590 |
588 template class DecoderStream<DemuxerStream::VIDEO>; | 591 template class DecoderStream<DemuxerStream::VIDEO>; |
589 template class DecoderStream<DemuxerStream::AUDIO>; | 592 template class DecoderStream<DemuxerStream::AUDIO>; |
590 | 593 |
591 } // namespace media | 594 } // namespace media |
OLD | NEW |