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

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

Issue 416333011: Allow setContentDecryptionModule() to get called when setting is done. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const & Created 6 years, 4 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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); 139 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB());
140 pending_buffer_to_decode_ = NULL; 140 pending_buffer_to_decode_ = NULL;
141 if (!init_cb_.is_null()) 141 if (!init_cb_.is_null())
142 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); 142 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED);
143 if (!decode_cb_.is_null()) 143 if (!decode_cb_.is_null())
144 base::ResetAndReturn(&decode_cb_).Run(kAborted); 144 base::ResetAndReturn(&decode_cb_).Run(kAborted);
145 if (!reset_cb_.is_null()) 145 if (!reset_cb_.is_null())
146 base::ResetAndReturn(&reset_cb_).Run(); 146 base::ResetAndReturn(&reset_cb_).Run();
147 } 147 }
148 148
149 void DecryptingVideoDecoder::SetDecryptor(Decryptor* decryptor) { 149 void DecryptingVideoDecoder::SetDecryptor(Decryptor* decryptor,
150 const base::Closure& done_cb) {
150 DVLOG(2) << "SetDecryptor()"; 151 DVLOG(2) << "SetDecryptor()";
151 DCHECK(task_runner_->BelongsToCurrentThread()); 152 DCHECK(task_runner_->BelongsToCurrentThread());
152 DCHECK_EQ(state_, kDecryptorRequested) << state_; 153 DCHECK_EQ(state_, kDecryptorRequested) << state_;
153 DCHECK(!init_cb_.is_null()); 154 DCHECK(!init_cb_.is_null());
154 DCHECK(!set_decryptor_ready_cb_.is_null()); 155 DCHECK(!set_decryptor_ready_cb_.is_null());
155 set_decryptor_ready_cb_.Reset(); 156 set_decryptor_ready_cb_.Reset();
156 157
157 if (!decryptor) { 158 if (!decryptor) {
158 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); 159 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED);
159 state_ = kError; 160 state_ = kError;
161 done_cb.Run();
ddorwin 2014/07/30 22:35:46 ditto
160 return; 162 return;
161 } 163 }
162 164
163 decryptor_ = decryptor; 165 decryptor_ = decryptor;
164 166
165 state_ = kPendingDecoderInit; 167 state_ = kPendingDecoderInit;
166 decryptor_->InitializeVideoDecoder( 168 decryptor_->InitializeVideoDecoder(
167 config_, 169 config_,
168 BindToCurrentLoop(base::Bind( 170 BindToCurrentLoop(base::Bind(
169 &DecryptingVideoDecoder::FinishInitialization, weak_this_))); 171 &DecryptingVideoDecoder::FinishInitialization, weak_this_)));
172 done_cb.Run();
170 } 173 }
171 174
172 void DecryptingVideoDecoder::FinishInitialization(bool success) { 175 void DecryptingVideoDecoder::FinishInitialization(bool success) {
173 DVLOG(2) << "FinishInitialization()"; 176 DVLOG(2) << "FinishInitialization()";
174 DCHECK(task_runner_->BelongsToCurrentThread()); 177 DCHECK(task_runner_->BelongsToCurrentThread());
175 DCHECK_EQ(state_, kPendingDecoderInit) << state_; 178 DCHECK_EQ(state_, kPendingDecoderInit) << state_;
176 DCHECK(!init_cb_.is_null()); 179 DCHECK(!init_cb_.is_null());
177 DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished. 180 DCHECK(reset_cb_.is_null()); // No Reset() before initialization finished.
178 DCHECK(decode_cb_.is_null()); // No Decode() before initialization finished. 181 DCHECK(decode_cb_.is_null()); // No Decode() before initialization finished.
179 182
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 307 }
305 308
306 void DecryptingVideoDecoder::DoReset() { 309 void DecryptingVideoDecoder::DoReset() {
307 DCHECK(init_cb_.is_null()); 310 DCHECK(init_cb_.is_null());
308 DCHECK(decode_cb_.is_null()); 311 DCHECK(decode_cb_.is_null());
309 state_ = kIdle; 312 state_ = kIdle;
310 base::ResetAndReturn(&reset_cb_).Run(); 313 base::ResetAndReturn(&reset_cb_).Run();
311 } 314 }
312 315
313 } // namespace media 316 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698