mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
audioringbuffer: don't attempt to reorder position-less channels
As said in its doc GST_AUDIO_CHANNEL_POSITION_NONE is meant to be used for "position-less channels, e.g. from a sound card that records 1024 channels; mutually exclusive with any other channel position". But at the moment using such positions would raise a 'g_return_if_reached' warning as gst_audio_get_channel_reorder_map() would reject it. Fix this by preventing any attempt to reorder in such case as that's not what we want anyway. https://bugzilla.gnome.org/show_bug.cgi?id=763799
This commit is contained in:
parent
1c56cfa144
commit
7c5dfd713c
1 changed files with 22 additions and 0 deletions
|
@ -1952,6 +1952,23 @@ gst_audio_ring_buffer_may_start (GstAudioRingBuffer * buf, gboolean allowed)
|
||||||
g_atomic_int_set (&buf->may_start, allowed);
|
g_atomic_int_set (&buf->may_start, allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* GST_AUDIO_CHANNEL_POSITION_NONE is used for position-less
|
||||||
|
* mutually exclusive channels. In this case we should not attempt
|
||||||
|
* to do any reordering.
|
||||||
|
*/
|
||||||
|
static gboolean
|
||||||
|
position_less_channels (const GstAudioChannelPosition * pos, guint channels)
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
for (i = 0; i < channels; i++) {
|
||||||
|
if (pos[i] != GST_AUDIO_CHANNEL_POSITION_NONE)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_audio_ring_buffer_set_channel_positions:
|
* gst_audio_ring_buffer_set_channel_positions:
|
||||||
* @buf: the #GstAudioRingBuffer
|
* @buf: the #GstAudioRingBuffer
|
||||||
|
@ -1977,6 +1994,11 @@ gst_audio_ring_buffer_set_channel_positions (GstAudioRingBuffer * buf,
|
||||||
if (memcmp (position, to, channels * sizeof (to[0])) == 0)
|
if (memcmp (position, to, channels * sizeof (to[0])) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (position_less_channels (position, channels)) {
|
||||||
|
GST_LOG_OBJECT (buf, "position-less channels, no need to reorder");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
buf->need_reorder = FALSE;
|
buf->need_reorder = FALSE;
|
||||||
if (!gst_audio_get_channel_reorder_map (channels, position, to,
|
if (!gst_audio_get_channel_reorder_map (channels, position, to,
|
||||||
buf->channel_reorder_map))
|
buf->channel_reorder_map))
|
||||||
|
|
Loading…
Reference in a new issue