osxaudiosink: channel-mask configuration fixes
authorPhilippe Normand <philn@igalia.com>
Wed, 17 Apr 2013 19:05:14 +0000 (21:05 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 18 Apr 2013 07:16:19 +0000 (09:16 +0200)
Set channel-mask according to sink's layout in case of stereo layout.
Also initialize and reset the mask when an unrecognized channel is detected.

https://bugzilla.gnome.org/show_bug.cgi?id=698224

sys/osxaudio/gstosxaudiosink.c

index bd348d0..56f4ee7 100644 (file)
@@ -537,7 +537,7 @@ gst_osx_audio_sink_allowed_caps (GstOsxAudioSink * osxsink)
   GstElementClass *element_class;
   GstPadTemplate *pad_template;
   GstCaps *caps, *in_caps;
-  guint64 channel_mask;
+  guint64 channel_mask = 0;
   GstAudioChannelPosition *pos = osxsink->channel_positions;
 
   /* First collect info about the HW capabilites and preferences */
@@ -567,6 +567,8 @@ gst_osx_audio_sink_allowed_caps (GstOsxAudioSink * osxsink)
     case 2:
       pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
       pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
+      channel_mask |= GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_LEFT);
+      channel_mask |= GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_RIGHT);
       break;
     default:
       channels = MIN (layout->mNumberChannelDescriptions,
@@ -612,6 +614,7 @@ gst_osx_audio_sink_allowed_caps (GstOsxAudioSink * osxsink)
           default:
             GST_WARNING_OBJECT (osxsink, "unrecognized channel: %d",
                 (int) layout->mChannelDescriptions[i].mChannelLabel);
+            channel_mask = 0;
             channels = 2;
             break;
         }