mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
rtpbasepayload: set attributes on newly requested extensions
Users were supposed to configure the extension themselves but it was impossible to do so as they didn't have access to the caps. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1021>
This commit is contained in:
parent
5acde5568e
commit
912cf46b83
3 changed files with 19 additions and 2 deletions
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue