Chromium Code Reviews| Index: media/filters/decrypting_audio_decoder.cc |
| diff --git a/media/filters/decrypting_audio_decoder.cc b/media/filters/decrypting_audio_decoder.cc |
| index 9d635818a925ad9c7ab1a522616bee32779e8ecc..4bf01271ebddebc91a2e92f4b38892c6756ba356 100644 |
| --- a/media/filters/decrypting_audio_decoder.cc |
| +++ b/media/filters/decrypting_audio_decoder.cc |
| @@ -194,13 +194,7 @@ void DecryptingAudioDecoder::FinishInitialization(bool success) { |
| } |
| // Success! |
| - const AudioDecoderConfig& config = demuxer_stream_->audio_decoder_config(); |
| - bits_per_channel_ = config.bits_per_channel(); |
| - channel_layout_ = config.channel_layout(); |
| - samples_per_second_ = config.samples_per_second(); |
| - const int kBitsPerByte = 8; |
| - bytes_per_sample_ = ChannelLayoutToChannelCount(channel_layout_) * |
| - bits_per_channel_ / kBitsPerByte; |
| + SetDecoderConfig(); |
| decryptor_->RegisterNewKeyCB( |
| Decryptor::kAudio, BIND_TO_LOOP(&DecryptingAudioDecoder::OnKeyAdded)); |
| @@ -224,6 +218,8 @@ void DecryptingAudioDecoder::FinishConfigChange(bool success) { |
| } |
| // Config change succeeded. |
| + SetDecoderConfig(); |
| + |
| if (!reset_cb_.is_null()) { |
| base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
| DoReset(); |
| @@ -447,6 +443,18 @@ void DecryptingAudioDecoder::DoReset() { |
| base::ResetAndReturn(&reset_cb_).Run(); |
| } |
| +void DecryptingAudioDecoder::SetDecoderConfig() { |
|
ddorwin
2013/01/11 05:19:57
I think it would be better to pass in the thing we
|
| + const AudioDecoderConfig& config = demuxer_stream_->audio_decoder_config(); |
| + bits_per_channel_ = config.bits_per_channel(); |
| + channel_layout_ = config.channel_layout(); |
| + samples_per_second_ = config.samples_per_second(); |
| + const int kBitsPerByte = 8; |
| + bytes_per_sample_ = ChannelLayoutToChannelCount(channel_layout_) * |
| + bits_per_channel_ / kBitsPerByte; |
| + output_timestamp_base_ = kNoTimestamp(); |
| + total_samples_decoded_ = 0; |
| +} |
| + |
| void DecryptingAudioDecoder::EnqueueFrames( |
| const Decryptor::AudioBuffers& frames) { |
| queued_audio_frames_ = frames; |