summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2024-06-14 16:20:31 +0100
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>2024-06-18 01:22:26 +0100
commite47895dbd24f861d3a60120a32ee3f3223e58fcf (patch)
treefd0da66fafec0b0882075c0b6fdd40319680a0ec
parent691ee34729e79e4f4e5a433f4051eccc9fc63717 (diff)
rtpdtmfdepay: fix caps negotiation with audioconvert
Specify "layout" field in src template to make sure it's set and gets fixated properly if the downstream element supports both interleaved and non-interleaved caps. Fixes gst_pad_set_caps: assertion 'caps != NULL && gst_caps_is_fixed (caps)' failed critical with e.g. gst-launch-1.0 rtpdtmfsrc ! rtpdtmfdepay ! audioconvert ! fakesink Not that the layout really matters in our case since we always output mono anyway, but non-interleaved requires adding AudioMeta, so this is the easiest fix. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7048>
-rw-r--r--subprojects/gst-plugins-good/docs/gst_plugins_cache.json2
-rw-r--r--subprojects/gst-plugins-good/gst/dtmf/gstrtpdtmfdepay.c10
-rw-r--r--subprojects/gst-plugins-good/tests/check/elements/dtmf.c3
3 files changed, 10 insertions, 5 deletions
diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
index d5e935b034..71d8f3b3bf 100644
--- a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
+++ b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
@@ -5444,7 +5444,7 @@
"presence": "always"
},
"src": {
- "caps": "audio/x-raw:\n format: S16LE\n rate: [ 1, 2147483647 ]\n channels: 1\n",
+ "caps": "audio/x-raw:\n format: S16LE\n rate: [ 1, 2147483647 ]\n channels: 1\n layout: interleaved\n",
"direction": "src",
"presence": "always"
}
diff --git a/subprojects/gst-plugins-good/gst/dtmf/gstrtpdtmfdepay.c b/subprojects/gst-plugins-good/gst/dtmf/gstrtpdtmfdepay.c
index b0e39473d7..16dd455b4a 100644
--- a/subprojects/gst-plugins-good/gst/dtmf/gstrtpdtmfdepay.c
+++ b/subprojects/gst-plugins-good/gst/dtmf/gstrtpdtmfdepay.c
@@ -138,9 +138,11 @@ static GstStaticPadTemplate gst_rtp_dtmf_depay_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw, "
- "format = (string) \"" GST_AUDIO_NE (S16) "\", "
- "rate = " GST_AUDIO_RATE_RANGE ", " "channels = (int) 1")
+ GST_STATIC_CAPS ("audio/x-raw, " //
+ "format = (string) " GST_AUDIO_NE (S16) ", " //
+ "rate = " GST_AUDIO_RATE_RANGE ", " //
+ "channels = (int) 1, " //
+ "layout = (string) interleaved")
);
static GstStaticPadTemplate gst_rtp_dtmf_depay_sink_template =
@@ -283,6 +285,8 @@ gst_rtp_dtmf_depay_setcaps (GstRTPBaseDepayload * filter, GstCaps * caps)
filtercaps);
gst_caps_unref (filtercaps);
+ srccaps = gst_caps_truncate (srccaps);
+
gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (filter), srccaps);
gst_caps_unref (srccaps);
diff --git a/subprojects/gst-plugins-good/tests/check/elements/dtmf.c b/subprojects/gst-plugins-good/tests/check/elements/dtmf.c
index c57a48c9dc..45f098454b 100644
--- a/subprojects/gst-plugins-good/tests/check/elements/dtmf.c
+++ b/subprojects/gst-plugins-good/tests/check/elements/dtmf.c
@@ -178,7 +178,8 @@ GST_START_TEST (test_rtpdtmfdepay)
caps_out = gst_pad_get_current_caps (sink);
expected_caps_out = gst_caps_new_simple ("audio/x-raw",
"format", G_TYPE_STRING, GST_AUDIO_NE (S16),
- "rate", G_TYPE_INT, 1000, "channels", G_TYPE_INT, 1, NULL);
+ "rate", G_TYPE_INT, 1000, "channels", G_TYPE_INT, 1,
+ "layout", G_TYPE_STRING, "interleaved", NULL);
fail_unless (gst_caps_is_equal_fixed (caps_out, expected_caps_out));
gst_caps_unref (expected_caps_out);
gst_caps_unref (caps_out);