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

Unified Diff: media/filters/decrypting_audio_decoder.cc

Issue 11824066: Encrypted Media: Update config/state after config changed in DecryptingAudioDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename SetAudioConfig to UpdateAudioConfig Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f94d1ecfee9b5b6b3abe4e4d0398e6a1a5b3d72d 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;
+ UpdateDecoderConfig();
decryptor_->RegisterNewKeyCB(
Decryptor::kAudio, BIND_TO_LOOP(&DecryptingAudioDecoder::OnKeyAdded));
@@ -224,6 +218,8 @@ void DecryptingAudioDecoder::FinishConfigChange(bool success) {
}
// Config change succeeded.
+ UpdateDecoderConfig();
+
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::UpdateDecoderConfig() {
+ 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;
« 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