| 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_selector.h" | 5 #include "media/filters/decoder_selector.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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 #if !defined(OS_ANDROID) | 128 #if !defined(OS_ANDROID) |
| 129 template <DemuxerStream::Type StreamType> | 129 template <DemuxerStream::Type StreamType> |
| 130 void DecoderSelector<StreamType>::InitializeDecryptingDecoder() { | 130 void DecoderSelector<StreamType>::InitializeDecryptingDecoder() { |
| 131 DVLOG(2) << __func__; | 131 DVLOG(2) << __func__; |
| 132 decoder_.reset(new typename StreamTraits::DecryptingDecoderType( | 132 decoder_.reset(new typename StreamTraits::DecryptingDecoderType( |
| 133 task_runner_, media_log_, waiting_for_decryption_key_cb_)); | 133 task_runner_, media_log_, waiting_for_decryption_key_cb_)); |
| 134 | 134 |
| 135 traits_->InitializeDecoder( | 135 traits_->InitializeDecoder( |
| 136 decoder_.get(), input_stream_, cdm_context_, | 136 decoder_.get(), StreamTraits::GetDecoderConfig(input_stream_), |
| 137 input_stream_->liveness() == DemuxerStream::LIVENESS_LIVE, cdm_context_, |
| 137 base::Bind(&DecoderSelector<StreamType>::DecryptingDecoderInitDone, | 138 base::Bind(&DecoderSelector<StreamType>::DecryptingDecoderInitDone, |
| 138 weak_ptr_factory_.GetWeakPtr()), | 139 weak_ptr_factory_.GetWeakPtr()), |
| 139 output_cb_); | 140 output_cb_); |
| 140 } | 141 } |
| 141 | 142 |
| 142 template <DemuxerStream::Type StreamType> | 143 template <DemuxerStream::Type StreamType> |
| 143 void DecoderSelector<StreamType>::DecryptingDecoderInitDone(bool success) { | 144 void DecoderSelector<StreamType>::DecryptingDecoderInitDone(bool success) { |
| 144 DVLOG(2) << __func__ << ": success=" << success; | 145 DVLOG(2) << __func__ << ": success=" << success; |
| 145 DCHECK(task_runner_->BelongsToCurrentThread()); | 146 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 146 | 147 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 | 202 |
| 202 if (decoders_.empty()) { | 203 if (decoders_.empty()) { |
| 203 ReturnNullDecoder(); | 204 ReturnNullDecoder(); |
| 204 return; | 205 return; |
| 205 } | 206 } |
| 206 | 207 |
| 207 decoder_.reset(decoders_.front()); | 208 decoder_.reset(decoders_.front()); |
| 208 decoders_.weak_erase(decoders_.begin()); | 209 decoders_.weak_erase(decoders_.begin()); |
| 209 | 210 |
| 210 traits_->InitializeDecoder( | 211 traits_->InitializeDecoder( |
| 211 decoder_.get(), input_stream_, cdm_context_, | 212 decoder_.get(), StreamTraits::GetDecoderConfig(input_stream_), |
| 213 input_stream_->liveness() == DemuxerStream::LIVENESS_LIVE, cdm_context_, |
| 212 base::Bind(&DecoderSelector<StreamType>::DecoderInitDone, | 214 base::Bind(&DecoderSelector<StreamType>::DecoderInitDone, |
| 213 weak_ptr_factory_.GetWeakPtr()), | 215 weak_ptr_factory_.GetWeakPtr()), |
| 214 output_cb_); | 216 output_cb_); |
| 215 } | 217 } |
| 216 | 218 |
| 217 template <DemuxerStream::Type StreamType> | 219 template <DemuxerStream::Type StreamType> |
| 218 void DecoderSelector<StreamType>::DecoderInitDone(bool success) { | 220 void DecoderSelector<StreamType>::DecoderInitDone(bool success) { |
| 219 DVLOG(2) << __func__ << ": success=" << success; | 221 DVLOG(2) << __func__ << ": success=" << success; |
| 220 DCHECK(task_runner_->BelongsToCurrentThread()); | 222 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 221 | 223 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 244 | 246 |
| 245 // These forward declarations tell the compiler that we will use | 247 // These forward declarations tell the compiler that we will use |
| 246 // DecoderSelector with these arguments, allowing us to keep these definitions | 248 // DecoderSelector with these arguments, allowing us to keep these definitions |
| 247 // in our .cc without causing linker errors. This also means if anyone tries to | 249 // in our .cc without causing linker errors. This also means if anyone tries to |
| 248 // instantiate a DecoderSelector with anything but these two specializations | 250 // instantiate a DecoderSelector with anything but these two specializations |
| 249 // they'll most likely get linker errors. | 251 // they'll most likely get linker errors. |
| 250 template class DecoderSelector<DemuxerStream::AUDIO>; | 252 template class DecoderSelector<DemuxerStream::AUDIO>; |
| 251 template class DecoderSelector<DemuxerStream::VIDEO>; | 253 template class DecoderSelector<DemuxerStream::VIDEO>; |
| 252 | 254 |
| 253 } // namespace media | 255 } // namespace media |
| OLD | NEW |