Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Side by Side Diff: media/filters/decoder_selector.cc

Issue 2623273008: media: Add logs in DecoderSelector to show selection result (Closed)
Patch Set: media: Add logs in DecoderSelector to show selection result Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 traits_->InitializeDecoder( 135 traits_->InitializeDecoder(
136 decoder_.get(), input_stream_, cdm_context_, 136 decoder_.get(), input_stream_, cdm_context_,
137 base::Bind(&DecoderSelector<StreamType>::DecryptingDecoderInitDone, 137 base::Bind(&DecoderSelector<StreamType>::DecryptingDecoderInitDone,
138 weak_ptr_factory_.GetWeakPtr()), 138 weak_ptr_factory_.GetWeakPtr()),
139 output_cb_); 139 output_cb_);
140 } 140 }
141 141
142 template <DemuxerStream::Type StreamType> 142 template <DemuxerStream::Type StreamType>
143 void DecoderSelector<StreamType>::DecryptingDecoderInitDone(bool success) { 143 void DecoderSelector<StreamType>::DecryptingDecoderInitDone(bool success) {
144 DVLOG(2) << __func__; 144 DVLOG(2) << __func__ << ": success=" << success;
145 DCHECK(task_runner_->BelongsToCurrentThread()); 145 DCHECK(task_runner_->BelongsToCurrentThread());
146 146
147 if (success) { 147 if (success) {
148 DVLOG(1) << __func__ << ": " << decoder_->GetDisplayName() << " selected.";
148 base::ResetAndReturn(&select_decoder_cb_) 149 base::ResetAndReturn(&select_decoder_cb_)
149 .Run(std::move(decoder_), std::unique_ptr<DecryptingDemuxerStream>()); 150 .Run(std::move(decoder_), std::unique_ptr<DecryptingDemuxerStream>());
150 return; 151 return;
151 } 152 }
152 153
153 decoder_.reset(); 154 decoder_.reset();
154 155
155 // When we get here decrypt-and-decode is not supported. Try to use 156 // When we get here decrypt-and-decode is not supported. Try to use
156 // DecryptingDemuxerStream to do decrypt-only. 157 // DecryptingDemuxerStream to do decrypt-only.
157 InitializeDecryptingDemuxerStream(); 158 InitializeDecryptingDemuxerStream();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 208
208 traits_->InitializeDecoder( 209 traits_->InitializeDecoder(
209 decoder_.get(), input_stream_, cdm_context_, 210 decoder_.get(), input_stream_, cdm_context_,
210 base::Bind(&DecoderSelector<StreamType>::DecoderInitDone, 211 base::Bind(&DecoderSelector<StreamType>::DecoderInitDone,
211 weak_ptr_factory_.GetWeakPtr()), 212 weak_ptr_factory_.GetWeakPtr()),
212 output_cb_); 213 output_cb_);
213 } 214 }
214 215
215 template <DemuxerStream::Type StreamType> 216 template <DemuxerStream::Type StreamType>
216 void DecoderSelector<StreamType>::DecoderInitDone(bool success) { 217 void DecoderSelector<StreamType>::DecoderInitDone(bool success) {
217 DVLOG(2) << __func__; 218 DVLOG(2) << __func__ << ": success=" << success;
218 DCHECK(task_runner_->BelongsToCurrentThread()); 219 DCHECK(task_runner_->BelongsToCurrentThread());
219 220
220 if (!success) { 221 if (!success) {
221 decoder_.reset(); 222 decoder_.reset();
222 InitializeDecoder(); 223 InitializeDecoder();
223 return; 224 return;
224 } 225 }
225 226
227 DVLOG(1) << __func__ << ": " << decoder_->GetDisplayName()
228 << " selected. DecryptingDemuxerStream "
229 << (decrypted_stream_ ? "also" : "not") << " selected.";
230
226 base::ResetAndReturn(&select_decoder_cb_) 231 base::ResetAndReturn(&select_decoder_cb_)
227 .Run(std::move(decoder_), std::move(decrypted_stream_)); 232 .Run(std::move(decoder_), std::move(decrypted_stream_));
228 } 233 }
229 234
230 template <DemuxerStream::Type StreamType> 235 template <DemuxerStream::Type StreamType>
231 void DecoderSelector<StreamType>::ReturnNullDecoder() { 236 void DecoderSelector<StreamType>::ReturnNullDecoder() {
232 DVLOG(2) << __func__; 237 DVLOG(1) << __func__ << ": No decoder selected.";
233 DCHECK(task_runner_->BelongsToCurrentThread()); 238 DCHECK(task_runner_->BelongsToCurrentThread());
234 base::ResetAndReturn(&select_decoder_cb_) 239 base::ResetAndReturn(&select_decoder_cb_)
235 .Run(std::unique_ptr<Decoder>(), 240 .Run(std::unique_ptr<Decoder>(),
236 std::unique_ptr<DecryptingDemuxerStream>()); 241 std::unique_ptr<DecryptingDemuxerStream>());
237 } 242 }
238 243
239 // These forward declarations tell the compiler that we will use 244 // These forward declarations tell the compiler that we will use
240 // DecoderSelector with these arguments, allowing us to keep these definitions 245 // DecoderSelector with these arguments, allowing us to keep these definitions
241 // in our .cc without causing linker errors. This also means if anyone tries to 246 // in our .cc without causing linker errors. This also means if anyone tries to
242 // instantiate a DecoderSelector with anything but these two specializations 247 // instantiate a DecoderSelector with anything but these two specializations
243 // they'll most likely get linker errors. 248 // they'll most likely get linker errors.
244 template class DecoderSelector<DemuxerStream::AUDIO>; 249 template class DecoderSelector<DemuxerStream::AUDIO>;
245 template class DecoderSelector<DemuxerStream::VIDEO>; 250 template class DecoderSelector<DemuxerStream::VIDEO>;
246 251
247 } // namespace media 252 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698