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

Unified Diff: media/filters/decrypting_audio_decoder.cc

Issue 11778079: Encrypted Media: Enforcing the CDM to decode audio into S16 integers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 f94d1ecfee9b5b6b3abe4e4d0398e6a1a5b3d72d..10232f2be35fa73d3bdf2489098938bf2dfd4333 100644
--- a/media/filters/decrypting_audio_decoder.cc
+++ b/media/filters/decrypting_audio_decoder.cc
@@ -25,6 +25,8 @@ namespace media {
#define BIND_TO_LOOP(function) \
media::BindToLoop(message_loop_, base::Bind(function, this))
+const int DecryptingAudioDecoder::kSupportedBitsPerChannel = 16;
+
static inline bool IsOutOfSync(const base::TimeDelta& timestamp_1,
const base::TimeDelta& timestamp_2) {
// Out of sync of 100ms would be pretty noticeable and we should keep any
@@ -170,8 +172,17 @@ void DecryptingAudioDecoder::SetDecryptor(Decryptor* decryptor) {
set_decryptor_ready_cb_.Reset();
decryptor_ = decryptor;
+ const AudioDecoderConfig& input_config =
+ demuxer_stream_->audio_decoder_config();
scoped_ptr<AudioDecoderConfig> scoped_config(new AudioDecoderConfig());
- scoped_config->CopyFrom(demuxer_stream_->audio_decoder_config());
+ scoped_config->Initialize(input_config.codec(),
+ kSampleFormatS16,
+ input_config.channel_layout(),
+ input_config.samples_per_second(),
+ input_config.extra_data(),
+ input_config.extra_data_size(),
+ input_config.is_encrypted(),
+ false);
state_ = kPendingDecoderInit;
decryptor_->InitializeAudioDecoder(
@@ -281,8 +292,17 @@ void DecryptingAudioDecoder::DoDecryptAndDecodeBuffer(
if (status == DemuxerStream::kConfigChanged) {
DVLOG(2) << "DoDecryptAndDecodeBuffer() - kConfigChanged";
- scoped_ptr<AudioDecoderConfig> scoped_config(new AudioDecoderConfig());
- scoped_config->CopyFrom(demuxer_stream_->audio_decoder_config());
+ const AudioDecoderConfig& input_config =
+ demuxer_stream_->audio_decoder_config();
+ scoped_ptr<AudioDecoderConfig> scoped_config(new AudioDecoderConfig());
+ scoped_config->Initialize(input_config.codec(),
+ kSampleFormatS16,
+ input_config.channel_layout(),
+ input_config.samples_per_second(),
+ input_config.extra_data(),
+ input_config.extra_data_size(),
+ input_config.is_encrypted(),
+ false);
state_ = kPendingConfigChange;
decryptor_->DeinitializeDecoder(Decryptor::kAudio);
@@ -445,7 +465,7 @@ void DecryptingAudioDecoder::DoReset() {
void DecryptingAudioDecoder::UpdateDecoderConfig() {
const AudioDecoderConfig& config = demuxer_stream_->audio_decoder_config();
- bits_per_channel_ = config.bits_per_channel();
+ bits_per_channel_ = kSupportedBitsPerChannel;
channel_layout_ = config.channel_layout();
samples_per_second_ = config.samples_per_second();
const int kBitsPerByte = 8;
« 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