Commit 1a69ec3f authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠

alsa: if no formats in native endianness could be detected, try non-native endianness as well

This can happen, e.g. when using an USB sound card on
a big-endian device
parent 1e329bb4
......@@ -497,10 +497,20 @@ gst_alsa_probe_supported_formats (GstObject * obj, gchar * device,
stream_type = snd_pcm_stream (handle);
caps = gst_caps_copy (template_caps);
caps = gst_alsa_detect_formats (obj, hw_params,
gst_caps_copy (template_caps), G_BYTE_ORDER);
if (!(caps = gst_alsa_detect_formats (obj, hw_params, caps, G_BYTE_ORDER)))
goto subroutine_error;
/* if there are no formats in native endianness, try non-native as well */
if (caps == NULL) {
GST_INFO_OBJECT (obj, "no formats in native endianness detected");
caps = gst_alsa_detect_formats (obj, hw_params,
gst_caps_copy (template_caps),
if (caps == NULL)
goto subroutine_error;
if (!(caps = gst_alsa_detect_rates (obj, hw_params, caps)))
goto subroutine_error;
......@@ -533,7 +543,7 @@ subroutine_error:
GST_ERROR_OBJECT (obj, "failed to query formats");
snd_pcm_hw_params_free (hw_params);
gst_caps_unref (caps);
gst_caps_replace (&caps, NULL);
return NULL;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment