From: Tim-Philipp Müller Date: Mon, 4 Nov 2013 23:20:17 +0000 (+0000) Subject: avaudec: don't put bogus 0 channel-mask on output caps for mono audio X-Git-Tag: 1.19.3~499^2~643 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4072c40b8e74bbab1fb259b8d7f55d626d93c745;p=platform%2Fupstream%2Fgstreamer.git avaudec: don't put bogus 0 channel-mask on output caps for mono audio --- diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c index 0639b72..a5be63e 100644 --- a/ext/libav/gstavcodecmap.c +++ b/ext/libav/gstavcodecmap.c @@ -522,20 +522,18 @@ gst_ff_aud_caps_new (AVCodecContext * context, AVCodec * codec, /* fixed, non-probing context */ if (context != NULL && context->channels != -1) { GstAudioChannelPosition pos[64]; + guint64 mask; caps = gst_caps_new_simple (mimetype, "rate", G_TYPE_INT, context->sample_rate, "channels", G_TYPE_INT, context->channels, NULL); - if (gst_ffmpeg_channel_layout_to_gst (context->channel_layout, - context->channels, pos)) { - guint64 mask; - - if (gst_audio_channel_positions_to_mask (pos, context->channels, FALSE, - &mask)) { - gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, mask, - NULL); - } + if (context->channels > 1 && + gst_ffmpeg_channel_layout_to_gst (context->channel_layout, + context->channels, pos) && + gst_audio_channel_positions_to_mask (pos, context->channels, FALSE, + &mask)) { + gst_caps_set_simple (caps, "channel-mask", GST_TYPE_BITMASK, mask, NULL); } } else if (encode) { gint maxchannels = 2;