From 7abe0a56af44446eb153185f10736cfb11fcd0ff Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Mon, 6 Dec 2010 22:48:09 +0530 Subject: [PATCH] audioparse: Allow implicit channel map for 1-/2-channel audio This makes sure we don't set an empty channel map array for 1-/2-channel audio, causing an assert later on. --- gst/rawparse/gstaudioparse.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gst/rawparse/gstaudioparse.c b/gst/rawparse/gstaudioparse.c index 1341c57..d4f82ba 100644 --- a/gst/rawparse/gstaudioparse.c +++ b/gst/rawparse/gstaudioparse.c @@ -373,6 +373,11 @@ gst_audio_parse_set_channel_positions (GstAudioParse * ap, GstStructure * s) GValue pos_array = { 0, }; gint i; + if (!ap->channel_positions && ap->channels <= 2) { + /* Implicit mapping for 1- and 2-channel audio is okay */ + return; + } + g_value_init (&pos_array, GST_TYPE_ARRAY); if (ap->channel_positions @@ -382,7 +387,8 @@ gst_audio_parse_set_channel_positions (GstAudioParse * ap, GstStructure * s) for (i = 0; i < ap->channels; i++) gst_value_array_append_value (&pos_array, g_value_array_get_nth (ap->channel_positions, i)); - } else if (ap->channels != 1 && ap->channels != 2) { + } else { + /* >2 channels and no explicit mapping */ GValue pos_none = { 0, }; GST_WARNING_OBJECT (ap, "Using NONE channel positions"); -- 2.7.4