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

Side by Side Diff: media/filters/decrypting_audio_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: rebase + android tweaks 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_audio_decoder.h" 5 #include "media/filters/decrypting_audio_decoder.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); 159 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB());
160 pending_buffer_to_decode_ = NULL; 160 pending_buffer_to_decode_ = NULL;
161 if (!init_cb_.is_null()) 161 if (!init_cb_.is_null())
162 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); 162 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED);
163 if (!decode_cb_.is_null()) 163 if (!decode_cb_.is_null())
164 base::ResetAndReturn(&decode_cb_).Run(kAborted); 164 base::ResetAndReturn(&decode_cb_).Run(kAborted);
165 if (!reset_cb_.is_null()) 165 if (!reset_cb_.is_null())
166 base::ResetAndReturn(&reset_cb_).Run(); 166 base::ResetAndReturn(&reset_cb_).Run();
167 } 167 }
168 168
169 void DecryptingAudioDecoder::SetDecryptor(Decryptor* decryptor) { 169 void DecryptingAudioDecoder::SetDecryptor(
170 Decryptor* decryptor,
171 const DecryptorAttachedCB& decryptor_attached_cb) {
170 DVLOG(2) << "SetDecryptor()"; 172 DVLOG(2) << "SetDecryptor()";
171 DCHECK(task_runner_->BelongsToCurrentThread()); 173 DCHECK(task_runner_->BelongsToCurrentThread());
172 DCHECK_EQ(state_, kDecryptorRequested) << state_; 174 DCHECK_EQ(state_, kDecryptorRequested) << state_;
173 DCHECK(!init_cb_.is_null()); 175 DCHECK(!init_cb_.is_null());
174 DCHECK(!set_decryptor_ready_cb_.is_null()); 176 DCHECK(!set_decryptor_ready_cb_.is_null());
175 177
176 set_decryptor_ready_cb_.Reset(); 178 set_decryptor_ready_cb_.Reset();
177 179
178 if (!decryptor) { 180 if (!decryptor) {
179 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); 181 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED);
180 state_ = kError; 182 state_ = kError;
183 decryptor_attached_cb.Run(false);
181 return; 184 return;
182 } 185 }
183 186
184 decryptor_ = decryptor; 187 decryptor_ = decryptor;
185 188
186 InitializeDecoder(); 189 InitializeDecoder();
190 decryptor_attached_cb.Run(true);
187 } 191 }
188 192
189 void DecryptingAudioDecoder::InitializeDecoder() { 193 void DecryptingAudioDecoder::InitializeDecoder() {
190 state_ = kPendingDecoderInit; 194 state_ = kPendingDecoderInit;
191 decryptor_->InitializeAudioDecoder( 195 decryptor_->InitializeAudioDecoder(
192 config_, 196 config_,
193 BindToCurrentLoop(base::Bind( 197 BindToCurrentLoop(base::Bind(
194 &DecryptingAudioDecoder::FinishInitialization, weak_this_))); 198 &DecryptingAudioDecoder::FinishInitialization, weak_this_)));
195 } 199 }
196 200
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 354 }
351 355
352 frame->set_timestamp(current_time); 356 frame->set_timestamp(current_time);
353 timestamp_helper_->AddFrames(frame->frame_count()); 357 timestamp_helper_->AddFrames(frame->frame_count());
354 358
355 output_cb_.Run(frame); 359 output_cb_.Run(frame);
356 } 360 }
357 } 361 }
358 362
359 } // namespace media 363 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder.h ('k') | media/filters/decrypting_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698