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

Unified Diff: media/ffmpeg/ffmpeg_common.cc

Issue 10829470: Support for parsing encrypted WebM streams by src. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tool player_x11 Created 7 years, 9 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/ffmpeg/ffmpeg_common.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/ffmpeg/ffmpeg_common.cc
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index bf234304aa2b26fb7e0f729a4e75257099c00358..e8a44c7837b444319be7a694cb81ddb75621dcae 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -295,8 +295,9 @@ static ChannelLayout GuessChannelLayout(int channels) {
return CHANNEL_LAYOUT_UNSUPPORTED;
}
-void AVCodecContextToAudioDecoderConfig(
+static void AVCodecContextToAudioDecoderConfig(
const AVCodecContext* codec_context,
+ bool is_encrypted,
AudioDecoderConfig* config) {
DCHECK_EQ(codec_context->codec_type, AVMEDIA_TYPE_AUDIO);
@@ -320,7 +321,7 @@ void AVCodecContextToAudioDecoderConfig(
codec_context->sample_rate,
codec_context->extradata,
codec_context->extradata_size,
- false, // Not encrypted.
+ is_encrypted,
true);
if (codec != kCodecOpus) {
DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt) * 8,
@@ -328,6 +329,17 @@ void AVCodecContextToAudioDecoderConfig(
}
}
+void AVStreamToAudioDecoderConfig(
+ const AVStream* stream,
+ AudioDecoderConfig* config) {
+ bool is_encrypted = false;
+ AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0);
+ if (key)
+ is_encrypted = true;
+ return AVCodecContextToAudioDecoderConfig(stream->codec,
+ is_encrypted, config);
+}
+
void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config,
AVCodecContext* codec_context) {
codec_context->codec_type = AVMEDIA_TYPE_AUDIO;
@@ -391,12 +403,17 @@ void AVStreamToVideoDecoderConfig(
coded_size = natural_size;
}
+ bool is_encrypted = false;
+ AVDictionaryEntry* key = av_dict_get(stream->metadata, "enc_key_id", NULL, 0);
+ if (key)
+ is_encrypted = true;
+
config->Initialize(codec,
profile,
format,
coded_size, visible_rect, natural_size,
stream->codec->extradata, stream->codec->extradata_size,
- false, // Not encrypted.
+ is_encrypted,
true);
}
« no previous file with comments | « media/ffmpeg/ffmpeg_common.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698