OLD | NEW |
---|---|
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 Loading... | |
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 state_ = kDecodeFinished; | |
qinmin
2013/06/18 22:09:20
why the state_ value is different between Decrypti
xhwang
2013/06/18 22:34:23
The classic answer is "for historical reasons".
L
ddorwin
2013/06/19 00:06:50
Do we have a bug tracking this?
xhwang
2013/06/19 00:37:45
Done.
| |
180 return; | |
181 } | |
182 | |
176 decryptor_ = decryptor; | 183 decryptor_ = decryptor; |
177 | 184 |
178 const AudioDecoderConfig& input_config = | 185 const AudioDecoderConfig& input_config = |
179 demuxer_stream_->audio_decoder_config(); | 186 demuxer_stream_->audio_decoder_config(); |
180 AudioDecoderConfig config; | 187 AudioDecoderConfig config; |
181 config.Initialize(input_config.codec(), | 188 config.Initialize(input_config.codec(), |
182 kSampleFormatS16, | 189 kSampleFormatS16, |
183 input_config.channel_layout(), | 190 input_config.channel_layout(), |
184 input_config.samples_per_second(), | 191 input_config.samples_per_second(), |
185 input_config.extra_data(), | 192 input_config.extra_data(), |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 | 485 |
479 base::TimeDelta DecryptingAudioDecoder::NumberOfSamplesToDuration( | 486 base::TimeDelta DecryptingAudioDecoder::NumberOfSamplesToDuration( |
480 int number_of_samples) const { | 487 int number_of_samples) const { |
481 DCHECK(samples_per_second_); | 488 DCHECK(samples_per_second_); |
482 return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond * | 489 return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond * |
483 number_of_samples / | 490 number_of_samples / |
484 samples_per_second_); | 491 samples_per_second_); |
485 } | 492 } |
486 | 493 |
487 } // namespace media | 494 } // namespace media |
OLD | NEW |