| Index: webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
|
| diff --git a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
|
| index e49fa2ba0b5a6c93b3d043aab93e8bb48958638d..2b79e0b0f9f249819853d8c988cc4bd0e71dc614 100644
|
| --- a/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
|
| +++ b/webkit/media/crypto/ppapi/ffmpeg_cdm_audio_decoder.cc
|
| @@ -87,6 +87,8 @@ FFmpegCdmAudioDecoder::FFmpegCdmAudioDecoder(cdm::Allocator* allocator)
|
| av_frame_(NULL),
|
| bits_per_channel_(0),
|
| samples_per_second_(0),
|
| + channels_(0),
|
| + av_sample_format_(0),
|
| bytes_per_frame_(0),
|
| last_input_timestamp_(media::kNoTimestamp()),
|
| output_bytes_to_drop_(0) {
|
| @@ -154,6 +156,10 @@ bool FFmpegCdmAudioDecoder::Initialize(const cdm::AudioDecoderConfig& config) {
|
| serialized_audio_frames_.reserve(bytes_per_frame_ * samples_per_second_);
|
| is_initialized_ = true;
|
|
|
| + // Store initial values to guard against midstream configuration changes.
|
| + channels_ = codec_context_->channels;
|
| + av_sample_format_ = codec_context_->sample_fmt;
|
| +
|
| return true;
|
| }
|
|
|
| @@ -269,10 +275,16 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer(
|
|
|
| int decoded_audio_size = 0;
|
| if (frame_decoded) {
|
| - int output_sample_rate = av_frame_->sample_rate;
|
| - if (output_sample_rate != samples_per_second_) {
|
| - DLOG(ERROR) << "Output sample rate (" << output_sample_rate
|
| - << ") doesn't match expected rate " << samples_per_second_;
|
| + if (av_frame_->sample_rate != samples_per_second_ ||
|
| + av_frame_->channels != channels_ ||
|
| + av_frame_->format != av_sample_format_) {
|
| + DLOG(ERROR) << "Unsupported midstream configuration change!"
|
| + << " Sample Rate: " << av_frame_->sample_rate << " vs "
|
| + << samples_per_second_
|
| + << ", Channels: " << av_frame_->channels << " vs "
|
| + << channels_
|
| + << ", Sample Format: " << av_frame_->format << " vs "
|
| + << av_sample_format_;
|
| return cdm::kDecodeError;
|
| }
|
|
|
|
|