a2dpsink: Fails many tests in Bluetooth SIG Certification
Hi there,
I had to certifiy our software stack (blueZ+GStreamer) for Bluetooth and noticed that the a2dpsink element fails to connect to bluetoothd whenever the remote device uses SBC codec and reports a bitpool that has a fixed value (e.g. min=18 and max=18). I get the following assertion:
(gst-launch-1.0:6784): GStreamer-CRITICAL **: 14:43:04.664: gst_value_set_int_range_step: assertion 'start < end' failed
And also notice that the bitpool is set to [0, 0]:
avdtpsink gstavdtpsink.c:305:gst_avdtp_sink_start:<avdtpsink> Got connection caps: audio/x-sbc, channel-mode=(string)mono, subbands=(int)4, blocks=(int)16, allocation-method=(string)snr, rate=(int)48000, bitpool=(int)[ 0, 0 ], channels=(int)1
Checking the source code I noticed that the lines storing the bitpool use the gst_value_set_int_range function
# sys/bluez/gstavdtputil.c +374
/* bitpool */
value = g_value_init (value, GST_TYPE_INT_RANGE);
gst_value_set_int_range (value,
MIN (sbc->min_bitpool, TEMPLATE_MAX_BITPOOL),
MIN (sbc->max_bitpool, TEMPLATE_MAX_BITPOOL));
gst_structure_set_value (structure, "bitpool", value);
g_value_unset (value);
Which (to my surprise) asserts that a range is defined as 'start < end', see gst/gstvalue.c (from gstreamer).
I am not sure if I should address this here (or at gstreamer repo). From the bluetooth specification I would assume that a bitpool may be fixed to a certain value, so reporting same values for min and max is expected behaviour. So from my perspective there are two options, change the GST_TYPE which would lead to a change in other elements as well, or change the GST_TYPE_INT_RANGE to omit this assertion.