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

Unified Diff: media/ffmpeg/ffmpeg_common.cc

Issue 390543002: Always use 48kHz for OPUS decoding. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test all teh things. Created 6 years, 5 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 | « no previous file | media/ffmpeg/ffmpeg_common_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 42642fbfbecd917c185699e0cc4c95066974b0cf..5f52fe95bad8f2d03deb889a2e0ef88b7016e32f 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -285,11 +285,19 @@ void AVCodecContextToAudioDecoderConfig(
ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout(
codec_context->channel_layout, codec_context->channels);
+ int sample_rate = codec_context->sample_rate;
if (codec == kCodecOpus) {
// |codec_context->sample_fmt| is not set by FFmpeg because Opus decoding is
// not enabled in FFmpeg. It doesn't matter what value is set here, so long
// as it's valid, the true sample format is selected inside the decoder.
sample_format = kSampleFormatF32;
+
+ // Always use 48kHz for OPUS. Technically we should match to the highest
+ // supported hardware sample rate among [8, 12, 16, 24, 48] kHz, but we
+ // don't know the hardware sample rate at this point and those rates are
+ // rarely used for output. See the "Input Sample Rate" section of the spec:
+ // http://tools.ietf.org/html/draft-terriberry-oggopus-01#page-11
+ sample_rate = 48000;
}
base::TimeDelta seek_preroll;
@@ -301,7 +309,7 @@ void AVCodecContextToAudioDecoderConfig(
config->Initialize(codec,
sample_format,
channel_layout,
- codec_context->sample_rate,
+ sample_rate,
codec_context->extradata,
codec_context->extradata_size,
is_encrypted,
« no previous file with comments | « no previous file | media/ffmpeg/ffmpeg_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698