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

Unified Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 2748023004: Fix unsupported audio channel layout (Closed)
Patch Set: Created 3 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 | « 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
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index 06233eaa7d141c033ac0c80a7574defee61d04ba..acccf2e595d9bf02d0b08ec128a0e0c81614d034 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -95,12 +95,17 @@ static int GetAudioBuffer(struct AVCodecContext* s, AVFrame* frame, int flags) {
return buffer_size_in_bytes;
int frames_required = buffer_size_in_bytes / bytes_per_channel / channels;
DCHECK_GE(frames_required, frame->nb_samples);
+
+ ChannelLayout channel_layout =
+ ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels);
+
+ if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) {
+ DLOG(ERROR) << "Unsupported channel layout.";
+ return AVERROR(EINVAL);
+ }
+
scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateBuffer(
- sample_format,
- ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels),
- channels,
- s->sample_rate,
- frames_required);
+ sample_format, channel_layout, channels, s->sample_rate, frames_required);
// Initialize the data[] and extended_data[] fields to point into the memory
// allocated for AudioBuffer. |number_of_planes| will be 1 for interleaved
« 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