audioringbuffer: Fix alaw/mulaw channel positions
authorLyon Wang <lyon.wang@freescale.com>
Thu, 18 Jun 2015 09:38:09 +0000 (17:38 +0800)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 22 Jun 2015 16:29:00 +0000 (18:29 +0200)
For alaw/mulaw we should also try to initialize the channel positions in the
ringbuffer's audio info. This allow pulsesink to directly use the channel
positions instead of using the default zero-initialized ones, which doesn't
work well.

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

gst-libs/gst/audio/gstaudioringbuffer.c

index d6f65f3..246c6f6 100644 (file)
@@ -218,6 +218,10 @@ gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps)
             gst_structure_get_int (structure, "channels", &info.channels)))
       goto parse_error;
 
+    if (!(gst_audio_channel_positions_from_mask (info.channels, 0,
+                info.position)))
+      goto parse_error;
+
     spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW;
     info.bpf = info.channels;
   } else if (g_str_equal (mimetype, "audio/x-mulaw")) {
@@ -226,6 +230,10 @@ gst_audio_ring_buffer_parse_caps (GstAudioRingBufferSpec * spec, GstCaps * caps)
             gst_structure_get_int (structure, "channels", &info.channels)))
       goto parse_error;
 
+    if (!(gst_audio_channel_positions_from_mask (info.channels, 0,
+                info.position)))
+      goto parse_error;
+
     spec->type = GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW;
     info.bpf = info.channels;
   } else if (g_str_equal (mimetype, "audio/x-iec958")) {