diff --git a/gst-libs/gst/rtp/gstrtpbasepayload.c b/gst-libs/gst/rtp/gstrtpbasepayload.c index e40c6c651e..ee4428772e 100644 --- a/gst-libs/gst/rtp/gstrtpbasepayload.c +++ b/gst-libs/gst/rtp/gstrtpbasepayload.c @@ -1388,8 +1388,17 @@ gst_rtp_base_payload_negotiate (GstRTPBasePayload * payload) "extension id %" G_GUINT64_FORMAT, uri, ext_id); gst_clear_object (&ext); } - /* it is the signal handler's responsibility to set attributes if - * required */ + + if (ext && !gst_rtp_header_extension_set_attributes_from_caps (ext, + srccaps)) { + GST_WARNING_OBJECT (payload, + "Failed to configure rtp header " "extension %" + GST_PTR_FORMAT " attributes from caps %" GST_PTR_FORMAT, + ext, srccaps); + res = FALSE; + g_clear_object (&ext); + goto ext_out; + } /* We don't create an extension implementation by default and require * the caller to set the appropriate extension if it's required */ diff --git a/tests/check/libs/rtpbasepayload.c b/tests/check/libs/rtpbasepayload.c index 73afca2ff6..a94faa5904 100644 --- a/tests/check/libs/rtpbasepayload.c +++ b/tests/check/libs/rtpbasepayload.c @@ -2150,16 +2150,20 @@ request_extension (GstRTPBasePayload * depayload, guint ext_id, GST_START_TEST (rtp_base_payload_caps_request) { GstRTPHeaderExtension *ext; + GstRTPDummyHdrExt *dummy; State *state; state = create_payloader ("application/x-rtp", &sinktmpl_with_extmap_str, NULL); ext = rtp_dummy_hdr_ext_new (); + dummy = GST_RTP_DUMMY_HDR_EXT (ext); gst_rtp_header_extension_set_id (ext, 4); g_signal_connect (state->element, "request-extension", G_CALLBACK (request_extension), ext); + fail_unless (dummy->set_attributes_count == 0); + set_state (state, GST_STATE_PLAYING); push_buffer (state, "pts", 0 * GST_SECOND, NULL); @@ -2175,6 +2179,7 @@ GST_START_TEST (rtp_base_payload_caps_request) validate_normal_start_events (0); fail_unless_equals_int (GST_RTP_DUMMY_HDR_EXT (ext)->write_count, 1); + fail_unless (dummy->set_attributes_count == 1); gst_object_unref (ext); destroy_payloader (state); diff --git a/tests/check/libs/rtpdummyhdrextimpl.c b/tests/check/libs/rtpdummyhdrextimpl.c index 180dbc80b3..379bfe1d25 100644 --- a/tests/check/libs/rtpdummyhdrextimpl.c +++ b/tests/check/libs/rtpdummyhdrextimpl.c @@ -53,6 +53,7 @@ struct _GstRTPDummyHdrExt GstRTPHeaderExtensionFlags supported_flags; guint read_count; guint write_count; + guint set_attributes_count; gchar *direction; gchar *attributes; @@ -245,6 +246,8 @@ gst_rtp_dummy_hdr_ext_set_attributes_from_caps (GstRTPHeaderExtension * ext, const gchar *ext_uri; const GValue *arr; + dummy->set_attributes_count++; + if (!field_name) return FALSE;