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

Side by Side Diff: media/filters/decrypting_demuxer_stream.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_demuxer_stream.h" 5 #include "media/filters/decrypting_demuxer_stream.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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); 153 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB());
154 if (!init_cb_.is_null()) 154 if (!init_cb_.is_null())
155 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); 155 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT);
156 if (!read_cb_.is_null()) 156 if (!read_cb_.is_null())
157 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); 157 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL);
158 if (!reset_cb_.is_null()) 158 if (!reset_cb_.is_null())
159 base::ResetAndReturn(&reset_cb_).Run(); 159 base::ResetAndReturn(&reset_cb_).Run();
160 pending_buffer_to_decrypt_ = NULL; 160 pending_buffer_to_decrypt_ = NULL;
161 } 161 }
162 162
163 void DecryptingDemuxerStream::SetDecryptor(Decryptor* decryptor) { 163 void DecryptingDemuxerStream::SetDecryptor(Decryptor* decryptor,
164 const base::Closure& done_cb) {
164 DVLOG(2) << __FUNCTION__; 165 DVLOG(2) << __FUNCTION__;
165 DCHECK(task_runner_->BelongsToCurrentThread()); 166 DCHECK(task_runner_->BelongsToCurrentThread());
166 DCHECK_EQ(state_, kDecryptorRequested) << state_; 167 DCHECK_EQ(state_, kDecryptorRequested) << state_;
167 DCHECK(!init_cb_.is_null()); 168 DCHECK(!init_cb_.is_null());
168 DCHECK(!set_decryptor_ready_cb_.is_null()); 169 DCHECK(!set_decryptor_ready_cb_.is_null());
169 170
170 set_decryptor_ready_cb_.Reset(); 171 set_decryptor_ready_cb_.Reset();
171 172
172 if (!decryptor) { 173 if (!decryptor) {
173 state_ = kUninitialized; 174 state_ = kUninitialized;
174 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED); 175 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED);
176 done_cb.Run();
ddorwin 2014/07/30 22:35:46 ditto
175 return; 177 return;
176 } 178 }
177 179
178 decryptor_ = decryptor; 180 decryptor_ = decryptor;
179 181
180 decryptor_->RegisterNewKeyCB( 182 decryptor_->RegisterNewKeyCB(
181 GetDecryptorStreamType(), 183 GetDecryptorStreamType(),
182 BindToCurrentLoop( 184 BindToCurrentLoop(
183 base::Bind(&DecryptingDemuxerStream::OnKeyAdded, weak_this_))); 185 base::Bind(&DecryptingDemuxerStream::OnKeyAdded, weak_this_)));
184 186
185 state_ = kIdle; 187 state_ = kIdle;
186 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK); 188 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
189 done_cb.Run();
187 } 190 }
188 191
189 void DecryptingDemuxerStream::DecryptBuffer( 192 void DecryptingDemuxerStream::DecryptBuffer(
190 DemuxerStream::Status status, 193 DemuxerStream::Status status,
191 const scoped_refptr<DecoderBuffer>& buffer) { 194 const scoped_refptr<DecoderBuffer>& buffer) {
192 DVLOG(3) << __FUNCTION__; 195 DVLOG(3) << __FUNCTION__;
193 DCHECK(task_runner_->BelongsToCurrentThread()); 196 DCHECK(task_runner_->BelongsToCurrentThread());
194 DCHECK_EQ(state_, kPendingDemuxerRead) << state_; 197 DCHECK_EQ(state_, kPendingDemuxerRead) << state_;
195 DCHECK(!read_cb_.is_null()); 198 DCHECK(!read_cb_.is_null());
196 DCHECK_EQ(buffer.get() != NULL, status == kOk) << status; 199 DCHECK_EQ(buffer.get() != NULL, status == kOk) << status;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 break; 384 break;
382 } 385 }
383 386
384 default: 387 default:
385 NOTREACHED(); 388 NOTREACHED();
386 return; 389 return;
387 } 390 }
388 } 391 }
389 392
390 } // namespace media 393 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698