[Bug 760778] New: avenc_* audio encoders have (bad) channel-mask for mono audio in sink pad template
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Mon Jan 18 04:20:45 PST 2016
https://bugzilla.gnome.org/show_bug.cgi?id=760778
Bug ID: 760778
Summary: avenc_* audio encoders have (bad) channel-mask for
mono audio in sink pad template
Classification: Platform
Product: GStreamer
Version: 1.4.5
OS: Linux
Status: NEW
Severity: normal
Priority: Normal
Component: gst-libav
Assignee: gstreamer-bugs at lists.freedesktop.org
Reporter: nyushchenko at dev.rtsoft.ru
QA Contact: gstreamer-bugs at lists.freedesktop.org
GNOME version: ---
$ gst-inspect avenc_mp2
...
SINK template: 'sink'
Availability: Always
Capabilities:
audio/x-raw
channel-mask: 0x0000000000000004
channels: 1
rate: { 48000, 44100, 32000, 24000, 22050, 16000 }
layout: interleaved
format: S16LE
...
This combination (channels=1, channel-mask=0x4) is not pleased by alsasrc:
$ gst-launch alsasrc ! audioconvert ! avenc_mp2 ! filesink location=/dev/null
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstAudioSrcClock
** (gst-launch-1.0:492): CRITICAL **: file
/home/jenkins/nikita/tke-build/build/
tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/gstreamer1.0-plugins-base
/1.4.5-r0/gst-plugins-base-1.4.5/gst-libs/gst/audio/gstaudioringbuffer.c: line
1
963 (gst_audio_ring_buffer_set_channel_positions): should not be reached
What happens is:
- on target board audio input is single-channel,
- at caps negotiation time, gst_audio_ring_buffer_parse_caps() for alsasrc is
called with caps originating from avenc_mp2 sink pad template,
- because channel-mask is defined, gst_audio_channel_positions_from_mask() is
used to compute channel positions for audio ringbuffer; with channel-mask=0x4
this results into position[0] set to GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- later, gst_audio_ring_buffer_set_channel_positions() is called from
alsasrc_parse_spec(); at this time alsa_position[alsa->channels-1] ipoint to
GST_AUDIO_CHANNEL_POSITION_MONO and rignbuffer's position[0] is
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
- gst_audio_ring_buffer_set_channel_positions() sees the difference nad calls
gst_audio_get_channel_reorder_map(),
- gst_audio_get_channel_reorder_map() returns FALSE because it refuces to work
with GST_AUDIO_CHANNEL_POSITION_MONO,
- this FALSE return causes the assertion failure.
As far as I understand, root cause of entire thing is that channel-mask should
not be defined for channels=1.
Channel-mask property on avenc_mp2's sink pad template originates from
gst_ff_aud_caps_new() in gst-libav:ext/libav/gstavcodecmap.c
This routine has two points where channel-mask property is added. First of
these is under "if (context->channels > 1)" condition but second is not.
I guess something like below patch is needed
diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c
index 0c53d10..398aedd 100644
--- a/ext/libav/gstavcodecmap.c
+++ b/ext/libav/gstavcodecmap.c
@@ -634,7 +634,8 @@ gst_ff_aud_caps_new (AVCodecContext * context, AVCodec *
codec,
while (*layouts) {
gint nbits_set = get_nbits_set (*layouts);
- if (gst_ffmpeg_channel_layout_to_gst (*layouts, nbits_set, pos)) {
+ if (nbits_set > 1 &&
+ gst_ffmpeg_channel_layout_to_gst (*layouts, nbits_set, pos)) {
guint64 mask;
if (gst_audio_channel_positions_to_mask (pos, nbits_set, FALSE,
... although not sure.
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list