jack: Fix assertion fail when device supports only mono channel

MAX should be larger than MIN for GST_TYPE_INT_RANGE.

GStreamer-CRITICAL **: 18:26:27.912:
gst_value_collect_int_range: assertion 'collect_values[0].v_int < collect_values[1].v_int' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1033>
This commit is contained in:
Seungha Yang 2021-07-26 18:43:04 +09:00 committed by GStreamer Marge Bot
parent b1fb787859
commit 9c9ad0c8d6
2 changed files with 14 additions and 6 deletions

View file

@ -949,9 +949,13 @@ gst_jack_audio_sink_getcaps (GstBaseSink * bsink, GstCaps * filter)
if (!sink->caps) {
sink->caps = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, GST_JACK_FORMAT_STR,
"layout", G_TYPE_STRING, "interleaved",
"rate", G_TYPE_INT, rate,
"channels", GST_TYPE_INT_RANGE, min, max, NULL);
"layout", G_TYPE_STRING, "interleaved", "rate", G_TYPE_INT, rate, NULL);
if (min == max) {
gst_caps_set_simple (sink->caps, "channels", G_TYPE_INT, min, NULL);
} else {
gst_caps_set_simple (sink->caps,
"channels", GST_TYPE_INT_RANGE, min, max, NULL);
}
}
GST_INFO_OBJECT (sink, "returning caps %" GST_PTR_FORMAT, sink->caps);

View file

@ -963,9 +963,13 @@ gst_jack_audio_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
if (!src->caps) {
src->caps = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, GST_JACK_FORMAT_STR,
"layout", G_TYPE_STRING, "interleaved",
"rate", G_TYPE_INT, rate,
"channels", GST_TYPE_INT_RANGE, min, max, NULL);
"layout", G_TYPE_STRING, "interleaved", "rate", G_TYPE_INT, rate, NULL);
if (min == max) {
gst_caps_set_simple (src->caps, "channels", G_TYPE_INT, min, NULL);
} else {
gst_caps_set_simple (src->caps,
"channels", GST_TYPE_INT_RANGE, min, max, NULL);
}
}
GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, src->caps);