diff options
author | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2023-01-12 14:32:30 -0500 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@ocrete.ca> | 2023-01-12 18:48:35 -0500 |
commit | c5939300552919d854462739ca555c5f37697a21 (patch) | |
tree | 0aed5e0ccde63877886d1445671e1c902cdf81eb | |
parent | 46a6f72f03f9178954bb14d1eec8970d6be12d0c (diff) | |
download | gstreamer-c5939300552919d854462739ca555c5f37697a21.tar.gz |
rtopuspay: Use GstStaticCaps to cache parsed caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3674>
-rw-r--r-- | subprojects/gst-plugins-good/gst/rtp/gstrtpopuspay.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtpopuspay.c b/subprojects/gst-plugins-good/gst/rtp/gstrtpopuspay.c index e2e15789e7..e62868c376 100644 --- a/subprojects/gst-plugins-good/gst/rtp/gstrtpopuspay.c +++ b/subprojects/gst-plugins-good/gst/rtp/gstrtpopuspay.c @@ -374,6 +374,10 @@ gst_rtp_opus_pay_getcaps (GstRTPBasePayload * payload, GstStructure *s; int channel_mapping_family = 0; GstCaps *caps, *peercaps, *tcaps, *tempcaps; + static GstStaticCaps opus_static_caps = GST_STATIC_CAPS ("application/x-rtp, " + "encoding-name=(string) { \"OPUS\", \"X-GST-OPUS-DRAFT-SPITTKA-00\"}"); + static GstStaticCaps multiopus_static_caps = + GST_STATIC_CAPS ("application/x-rtp, encoding-name=(string)MULTIOPUS"); if (pad == GST_RTP_BASE_PAYLOAD_SRCPAD (payload)) return @@ -394,8 +398,7 @@ gst_rtp_opus_pay_getcaps (GstRTPBasePayload * payload, caps = gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload)); - tempcaps = gst_caps_from_string ("application/x-rtp, " - "encoding-name=(string) { \"OPUS\", \"X-GST-OPUS-DRAFT-SPITTKA-00\"}"); + tempcaps = gst_static_caps_get (&opus_static_caps); if (!gst_caps_can_intersect (peercaps, tempcaps)) { GstCaps *multiopuscaps = gst_caps_new_simple ("audio/x-opus", "channel-mapping-family", G_TYPE_INT, 1, @@ -411,8 +414,7 @@ gst_rtp_opus_pay_getcaps (GstRTPBasePayload * payload, } gst_caps_unref (tempcaps); - tempcaps = gst_caps_new_simple ("application/x-rtp", - "encoding-name", G_TYPE_STRING, "MULTIOPUS", NULL); + tempcaps = gst_static_caps_get (&multiopus_static_caps); if (!gst_caps_can_intersect (peercaps, tempcaps)) { GstCaps *opuscaps = gst_caps_new_simple ("audio/x-opus", "channel-mapping-family", G_TYPE_INT, 0, |