mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
rtpbin: add a caps accumulator for the request-pt-map signal
Add an accumulator that stops the signal emission as soon as a caps has been retrieved. Otherwise the default handler would continue emitting the signal and possibly overwrite the result with NULL again.
This commit is contained in:
parent
ef20dfe031
commit
ddb0b9c422
1 changed files with 18 additions and 2 deletions
|
@ -1675,6 +1675,22 @@ _gst_element_accumulator (GSignalInvocationHint * ihint,
|
|||
return (element == NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_gst_caps_accumulator (GSignalInvocationHint * ihint,
|
||||
GValue * return_accu, const GValue * handler_return, gpointer dummy)
|
||||
{
|
||||
GstCaps *caps;
|
||||
|
||||
caps = g_value_get_boxed (handler_return);
|
||||
GST_DEBUG ("got caps %" GST_PTR_FORMAT, caps);
|
||||
|
||||
if (!(ihint->run_type & G_SIGNAL_RUN_CLEANUP))
|
||||
g_value_set_boxed (return_accu, caps);
|
||||
|
||||
/* stop emission if we have a caps */
|
||||
return (caps == NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
||||
{
|
||||
|
@ -1716,8 +1732,8 @@ gst_rtp_bin_class_init (GstRtpBinClass * klass)
|
|||
gst_rtp_bin_signals[SIGNAL_REQUEST_PT_MAP] =
|
||||
g_signal_new ("request-pt-map", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRtpBinClass, request_pt_map),
|
||||
NULL, NULL, g_cclosure_marshal_generic, GST_TYPE_CAPS, 2, G_TYPE_UINT,
|
||||
G_TYPE_UINT);
|
||||
_gst_caps_accumulator, NULL, g_cclosure_marshal_generic, GST_TYPE_CAPS,
|
||||
2, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
||||
/**
|
||||
* GstRtpBin::payload-type-change:
|
||||
|
|
Loading…
Reference in a new issue