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

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

Issue 2701203003: media: Prefer decrypting pipeline when CDM is attached (Closed)
Patch Set: comments addressed Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/decrypting_video_decoder.h" 5 #include "media/filters/decrypting_video_decoder.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 const OutputCB& output_cb) { 45 const OutputCB& output_cb) {
46 DVLOG(2) << __func__ << ": " << config.AsHumanReadableString(); 46 DVLOG(2) << __func__ << ": " << config.AsHumanReadableString();
47 47
48 DCHECK(task_runner_->BelongsToCurrentThread()); 48 DCHECK(task_runner_->BelongsToCurrentThread());
49 DCHECK(state_ == kUninitialized || 49 DCHECK(state_ == kUninitialized ||
50 state_ == kIdle || 50 state_ == kIdle ||
51 state_ == kDecodeFinished) << state_; 51 state_ == kDecodeFinished) << state_;
52 DCHECK(decode_cb_.is_null()); 52 DCHECK(decode_cb_.is_null());
53 DCHECK(reset_cb_.is_null()); 53 DCHECK(reset_cb_.is_null());
54 DCHECK(config.IsValidConfig()); 54 DCHECK(config.IsValidConfig());
55 DCHECK(cdm_context);
55 56
56 init_cb_ = BindToCurrentLoop(init_cb); 57 init_cb_ = BindToCurrentLoop(init_cb);
57 output_cb_ = BindToCurrentLoop(output_cb); 58 output_cb_ = BindToCurrentLoop(output_cb);
58 weak_this_ = weak_factory_.GetWeakPtr(); 59 weak_this_ = weak_factory_.GetWeakPtr();
59 config_ = config; 60 config_ = config;
60 61
61 if (state_ == kUninitialized) { 62 if (state_ == kUninitialized) {
62 // DecoderSelector only chooses |this| when the stream is encrypted.
63 // TODO(xhwang): We may also select this decoder for clear stream if a CDM
64 // is attached. Then we need to update this. See http://crbug.com/597443
65 DCHECK(config.is_encrypted());
66 DCHECK(cdm_context);
67 if (!cdm_context->GetDecryptor()) { 63 if (!cdm_context->GetDecryptor()) {
68 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no decryptor"; 64 MEDIA_LOG(DEBUG, media_log_) << GetDisplayName() << ": no decryptor";
69 base::ResetAndReturn(&init_cb_).Run(false); 65 base::ResetAndReturn(&init_cb_).Run(false);
70 return; 66 return;
71 } 67 }
72 68
73 decryptor_ = cdm_context->GetDecryptor(); 69 decryptor_ = cdm_context->GetDecryptor();
74 } else { 70 } else {
75 // Reinitialization (i.e. upon a config change). The new config can be 71 // Reinitialization (i.e. upon a config change). The new config can be
76 // encrypted or clear. 72 // encrypted or clear.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 309 }
314 310
315 void DecryptingVideoDecoder::DoReset() { 311 void DecryptingVideoDecoder::DoReset() {
316 DCHECK(init_cb_.is_null()); 312 DCHECK(init_cb_.is_null());
317 DCHECK(decode_cb_.is_null()); 313 DCHECK(decode_cb_.is_null());
318 state_ = kIdle; 314 state_ = kIdle;
319 base::ResetAndReturn(&reset_cb_).Run(); 315 base::ResetAndReturn(&reset_cb_).Run();
320 } 316 }
321 317
322 } // namespace media 318 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_demuxer_stream.cc ('k') | media/filters/video_decoder_selector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698