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

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

Issue 17422002: Encrypted Media: DecryptingXxx::SetDecryptor() accepts NULL decryptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add todo and bug. Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/filters/decrypting_audio_decoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 void DecryptingAudioDecoder::SetDecryptor(Decryptor* decryptor) { 168 void DecryptingAudioDecoder::SetDecryptor(Decryptor* decryptor) {
169 DVLOG(2) << "SetDecryptor()"; 169 DVLOG(2) << "SetDecryptor()";
170 DCHECK(message_loop_->BelongsToCurrentThread()); 170 DCHECK(message_loop_->BelongsToCurrentThread());
171 DCHECK_EQ(state_, kDecryptorRequested) << state_; 171 DCHECK_EQ(state_, kDecryptorRequested) << state_;
172 DCHECK(!init_cb_.is_null()); 172 DCHECK(!init_cb_.is_null());
173 DCHECK(!set_decryptor_ready_cb_.is_null()); 173 DCHECK(!set_decryptor_ready_cb_.is_null());
174 174
175 set_decryptor_ready_cb_.Reset(); 175 set_decryptor_ready_cb_.Reset();
176
177 if (!decryptor) {
178 base::ResetAndReturn(&init_cb_).Run(DECODER_ERROR_NOT_SUPPORTED);
179 // TODO(xhwang): Add kError state. See http://crbug.com/251503
180 state_ = kDecodeFinished;
181 return;
182 }
183
176 decryptor_ = decryptor; 184 decryptor_ = decryptor;
177 185
178 const AudioDecoderConfig& input_config = 186 const AudioDecoderConfig& input_config =
179 demuxer_stream_->audio_decoder_config(); 187 demuxer_stream_->audio_decoder_config();
180 AudioDecoderConfig config; 188 AudioDecoderConfig config;
181 config.Initialize(input_config.codec(), 189 config.Initialize(input_config.codec(),
182 kSampleFormatS16, 190 kSampleFormatS16,
183 input_config.channel_layout(), 191 input_config.channel_layout(),
184 input_config.samples_per_second(), 192 input_config.samples_per_second(),
185 input_config.extra_data(), 193 input_config.extra_data(),
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 486
479 base::TimeDelta DecryptingAudioDecoder::NumberOfSamplesToDuration( 487 base::TimeDelta DecryptingAudioDecoder::NumberOfSamplesToDuration(
480 int number_of_samples) const { 488 int number_of_samples) const {
481 DCHECK(samples_per_second_); 489 DCHECK(samples_per_second_);
482 return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond * 490 return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond *
483 number_of_samples / 491 number_of_samples /
484 samples_per_second_); 492 samples_per_second_);
485 } 493 }
486 494
487 } // namespace media 495 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/decrypting_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698