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

Unified Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 125027: Fixing bug that 8bit PCM stream is gabbled... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_audio_decoder.cc
===================================================================
--- media/filters/ffmpeg_audio_decoder.cc (revision 18403)
+++ media/filters/ffmpeg_audio_decoder.cc (working copy)
@@ -42,7 +42,16 @@
DCHECK_GT(av_get_bits_per_sample_format(codec_context_->sample_fmt), 0);
DCHECK_GT(codec_context_->sample_rate, 0);
- // Set the media format.
+ // Grab the codec context from FFmpeg demuxer.
+ AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
+ if (!codec || avcodec_open(codec_context_, codec) < 0) {
+ host_->Error(PIPELINE_ERROR_DECODE);
+ return false;
+ }
+
+ // When calling avcodec_find_decoder(), |codec_context_| might be altered by
+ // the decoder to give more accurate values of the output format of the
+ // decoder. So set the media format after a decoder is allocated.
// TODO(hclam): Reuse the information provided by the demuxer for now, we may
// need to wait until the first buffer is decoded to know the correct
// information.
@@ -54,13 +63,6 @@
media_format_.SetAsString(MediaFormat::kMimeType,
mime_type::kUncompressedAudio);
- // Grab the codec context from FFmpeg demuxer.
- AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
- if (!codec || avcodec_open(codec_context_, codec) < 0) {
- host_->Error(PIPELINE_ERROR_DECODE);
- return false;
- }
-
// Prepare the output buffer.
output_buffer_.reset(static_cast<uint8*>(av_malloc(kOutputBufferSize)));
if (!output_buffer_.get()) {
Property changes on: media\filters\ffmpeg_audio_decoder.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698