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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 template <DemuxerStream::Type StreamType> | 245 template <DemuxerStream::Type StreamType> |
246 base::TimeDelta DecoderStream<StreamType>::AverageDuration() const { | 246 base::TimeDelta DecoderStream<StreamType>::AverageDuration() const { |
247 DCHECK(task_runner_->BelongsToCurrentThread()); | 247 DCHECK(task_runner_->BelongsToCurrentThread()); |
248 return duration_tracker_.count() ? duration_tracker_.Average() | 248 return duration_tracker_.count() ? duration_tracker_.Average() |
249 : base::TimeDelta(); | 249 : base::TimeDelta(); |
250 } | 250 } |
251 | 251 |
252 template <DemuxerStream::Type StreamType> | 252 template <DemuxerStream::Type StreamType> |
253 void DecoderStream<StreamType>::SelectDecoder() { | 253 void DecoderStream<StreamType>::SelectDecoder() { |
| 254 // If we are already using DecryptingDemuxerStream (DDS), e.g. during |
| 255 // fallback, the |stream_| will always be clear. In this case, no need pass in |
| 256 // the |cdm_context_|. This will also help prevent creating a new DDS on top |
| 257 // of the current DDS. |
| 258 CdmContext* cdm_context = decrypting_demuxer_stream_ ? nullptr : cdm_context_; |
| 259 |
254 decoder_selector_->SelectDecoder( | 260 decoder_selector_->SelectDecoder( |
255 &traits_, stream_, cdm_context_, | 261 &traits_, stream_, cdm_context, |
256 base::Bind(&DecoderStream<StreamType>::OnDecoderSelected, | 262 base::Bind(&DecoderStream<StreamType>::OnDecoderSelected, |
257 weak_factory_.GetWeakPtr()), | 263 weak_factory_.GetWeakPtr()), |
258 base::Bind(&DecoderStream<StreamType>::OnDecodeOutputReady, | 264 base::Bind(&DecoderStream<StreamType>::OnDecodeOutputReady, |
259 fallback_weak_factory_.GetWeakPtr()), | 265 fallback_weak_factory_.GetWeakPtr()), |
260 waiting_for_decryption_key_cb_); | 266 waiting_for_decryption_key_cb_); |
261 } | 267 } |
262 | 268 |
263 template <DemuxerStream::Type StreamType> | 269 template <DemuxerStream::Type StreamType> |
264 void DecoderStream<StreamType>::OnDecoderSelected( | 270 void DecoderStream<StreamType>::OnDecoderSelected( |
265 std::unique_ptr<Decoder> selected_decoder, | 271 std::unique_ptr<Decoder> selected_decoder, |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 } | 780 } |
775 | 781 |
776 // The resetting process will be continued in OnDecoderReinitialized(). | 782 // The resetting process will be continued in OnDecoderReinitialized(). |
777 ReinitializeDecoder(); | 783 ReinitializeDecoder(); |
778 } | 784 } |
779 | 785 |
780 template class DecoderStream<DemuxerStream::VIDEO>; | 786 template class DecoderStream<DemuxerStream::VIDEO>; |
781 template class DecoderStream<DemuxerStream::AUDIO>; | 787 template class DecoderStream<DemuxerStream::AUDIO>; |
782 | 788 |
783 } // namespace media | 789 } // namespace media |
OLD | NEW |