After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763338 - funnel: add 'forward-sticky-events-mode' property
funnel: add 'forward-sticky-events-mode' property
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.7.90
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-08 18:52 UTC by Miguel París Díaz
Modified: 2018-11-03 12:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
funnel: add 'forward-sticky-events-mode' property (8.95 KB, patch)
2016-03-08 18:52 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (9.20 KB, patch)
2016-03-08 19:38 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (9.78 KB, patch)
2016-03-09 07:59 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (10.32 KB, patch)
2016-03-09 10:23 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (10.39 KB, patch)
2016-03-09 11:02 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (10.33 KB, patch)
2016-03-10 15:17 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (10.33 KB, patch)
2016-03-10 15:19 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (10.30 KB, patch)
2016-03-17 14:26 UTC, Miguel París Díaz
none Details | Review
funnel: add 'forward-sticky-events-mode' property (10.33 KB, patch)
2016-03-18 10:43 UTC, Miguel París Díaz
none Details | Review

Description Miguel París Díaz 2016-03-08 18:52:24 UTC
Created attachment 323424 [details] [review]
funnel: add 'forward-sticky-events-mode' property

Expands the idea of this issue: https://bugzilla.gnome.org/show_bug.cgi?id=749315
Comment 1 Miguel París Díaz 2016-03-08 19:38:06 UTC
Created attachment 323435 [details] [review]
funnel: add 'forward-sticky-events-mode' property
Comment 2 Sebastian Dröge (slomo) 2016-03-09 07:04:00 UTC
Review of attachment 323435 [details] [review]:

::: plugins/elements/gstfunnel.c
@@ +118,3 @@
+  GstFunnelPad *pad = GST_FUNNEL_PAD_CAST (gobject);
+
+  g_slist_free_full (pad->events_sent, (GDestroyNotify) gst_event_unref);

These should be cleared in PAUSED->READY already

@@ +369,3 @@
+{
+  GstFunnelPad *funnelpad = GST_FUNNEL_PAD_CAST (sinkpad);
+  gboolean ret = FALSE;

You probably want to return TRUE if mode==NEVER
Comment 3 Miguel París Díaz 2016-03-09 07:59:01 UTC
Created attachment 323479 [details] [review]
funnel: add 'forward-sticky-events-mode' property
Comment 4 Miguel París Díaz 2016-03-09 08:00:02 UTC
Review of attachment 323435 [details] [review]:

::: plugins/elements/gstfunnel.c
@@ +118,3 @@
+  GstFunnelPad *pad = GST_FUNNEL_PAD_CAST (gobject);
+
+  g_slist_free_full (pad->events_sent, (GDestroyNotify) gst_event_unref);

Done

@@ +369,3 @@
+{
+  GstFunnelPad *funnelpad = GST_FUNNEL_PAD_CAST (sinkpad);
+  gboolean ret = FALSE;

Done
Comment 5 Sebastian Dröge (slomo) 2016-03-09 10:10:11 UTC
Review of attachment 323479 [details] [review]:

::: plugins/elements/gstfunnel.c
@@ +67,3 @@
+
+  if (!mode_type) {
+    mode_type = g_enum_register_static ("FunnelForwardStickyEventsMode", modes);

Prefix the type name with Gst

@@ +117,2 @@
 static void
+gst_funneL_pad_finalize (GObject * gobject)

Maybe make that a lowercase L ;)

@@ +120,3 @@
+  GstFunnelPad *pad = GST_FUNNEL_PAD_CAST (gobject);
+
+  g_slist_free_full (pad->events_sent, (GDestroyNotify) gst_event_unref);

This should also be completely unneeded now. Or not?

@@ +176,3 @@
     case PROP_FORWARD_STICKY_EVENTS:
+      GST_WARNING_OBJECT (funnel,
+          "'forward-stick-events' deprecated: use 'forward-stick-events-mode'");

You can let the property select ONCE / ALWAYS, right?

@@ +196,3 @@
     case PROP_FORWARD_STICKY_EVENTS:
+      GST_WARNING_OBJECT (funnel,
+          "'forward-stick-events' deprecated: use 'forward-stick-events-mode'");

It should put *something* into the GValue at least, ideally you can translate the new field.
Comment 6 Miguel París Díaz 2016-03-09 10:22:53 UTC
Review of attachment 323479 [details] [review]:

::: plugins/elements/gstfunnel.c
@@ +67,3 @@
+
+  if (!mode_type) {
+    mode_type = g_enum_register_static ("FunnelForwardStickyEventsMode", modes);

Done

@@ +117,2 @@
 static void
+gst_funneL_pad_finalize (GObject * gobject)

What a fool mistake!!
Well seen ;)

Done

@@ +120,3 @@
+  GstFunnelPad *pad = GST_FUNNEL_PAD_CAST (gobject);
+
+  g_slist_free_full (pad->events_sent, (GDestroyNotify) gst_event_unref);

This is needed because pads can be removed without the elements goes to READY state.

@@ +176,3 @@
     case PROP_FORWARD_STICKY_EVENTS:
+      GST_WARNING_OBJECT (funnel,
+          "'forward-stick-events' deprecated: use 'forward-stick-events-mode'");

Done

@@ +196,3 @@
     case PROP_FORWARD_STICKY_EVENTS:
+      GST_WARNING_OBJECT (funnel,
+          "'forward-stick-events' deprecated: use 'forward-stick-events-mode'");

Done
Comment 7 Miguel París Díaz 2016-03-09 10:23:27 UTC
Created attachment 323494 [details] [review]
funnel: add 'forward-sticky-events-mode' property
Comment 8 Sebastian Dröge (slomo) 2016-03-09 10:46:13 UTC
Review of attachment 323494 [details] [review]:

::: plugins/elements/gstfunnel.c
@@ +121,3 @@
+  GstFunnelPad *pad = GST_FUNNEL_PAD_CAST (gobject);
+
+  g_slist_free_full (pad->events_sent, (GDestroyNotify) gst_event_unref);

Ok, if it's needed please chain up to the parent class' finalize here :) Otherwise you leak memory

@@ +183,3 @@
+      funnel->forward_sticky_events_mode =
+          v ? GST_FUNNEL_FORWARD_STICKY_EVENTS_MODE_ALWAYS :
+          GST_FUNNEL_FORWARD_STICKY_EVENTS_MODE_NEVER;

Wasn't the old mode the same as ALWAYS / ONCE?

@@ +396,3 @@
+    ret = gst_pad_push_event (funnel->srcpad, gst_event_ref (event));
+    funnelpad->events_sent =
+        g_slist_append (funnelpad->events_sent, gst_event_ref (event));

Appending to a GSList/GList is expensive. You don't care about order (or do you?), so just prepend. Or use a GQueue
Comment 9 Miguel París Díaz 2016-03-09 11:02:15 UTC
Review of attachment 323494 [details] [review]:

::: plugins/elements/gstfunnel.c
@@ +121,3 @@
+  GstFunnelPad *pad = GST_FUNNEL_PAD_CAST (gobject);
+
+  g_slist_free_full (pad->events_sent, (GDestroyNotify) gst_event_unref);

Done

@@ +183,3 @@
+      funnel->forward_sticky_events_mode =
+          v ? GST_FUNNEL_FORWARD_STICKY_EVENTS_MODE_ALWAYS :
+          GST_FUNNEL_FORWARD_STICKY_EVENTS_MODE_NEVER;

Done

@@ +396,3 @@
+    ret = gst_pad_push_event (funnel->srcpad, gst_event_ref (event));
+    funnelpad->events_sent =
+        g_slist_append (funnelpad->events_sent, gst_event_ref (event));

Done
Comment 10 Miguel París Díaz 2016-03-09 11:02:38 UTC
Created attachment 323498 [details] [review]
funnel: add 'forward-sticky-events-mode' property
Comment 11 Miguel París Díaz 2016-03-10 15:17:15 UTC
Created attachment 323649 [details] [review]
funnel: add 'forward-sticky-events-mode' property

The previous patch does not work properly and it changes the semantic of "on stream changes"
Comment 12 Miguel París Díaz 2016-03-10 15:19:07 UTC
Created attachment 323650 [details] [review]
funnel: add 'forward-sticky-events-mode' property

The patch accepted to be committed after freeze does not work properly and it changes the semantic of "on stream changes"
Comment 13 Sebastian Dröge (slomo) 2016-03-11 12:00:17 UTC
What about a unit test then? :)
Comment 14 Miguel París Díaz 2016-03-11 16:05:45 UTC
Yes, I should do an unit test.
When I have a slot of time I will do it ;).
Comment 15 Miguel París Díaz 2016-03-17 14:26:23 UTC
Created attachment 324189 [details] [review]
funnel: add 'forward-sticky-events-mode' property
Comment 16 Miguel París Díaz 2016-03-18 10:43:10 UTC
Created attachment 324244 [details] [review]
funnel: add 'forward-sticky-events-mode' property
Comment 17 Olivier Crête 2016-03-25 01:14:06 UTC
Review of attachment 324244 [details] [review]:

I'm not sure how "ONCE" mode can ever be correct? If it sends them once, maybe it should merge things like the caps, so create a caps that intersects all incoming caps, and somehow merge the segments also, etc. and then have a MERGE mode?

::: plugins/elements/gstfunnel.c
@@ +181,3 @@
+
+      GST_WARNING_OBJECT (funnel,
+          "'forward-stick-events' deprecated: use 'forward-stick-events-mode'");

s/stick/sticky/

@@ +206,3 @@
+    case PROP_FORWARD_STICKY_EVENTS:{
+      GST_WARNING_OBJECT (funnel,
+          "'forward-stick-events' deprecated: use 'forward-stick-events-mode'");

s/stick/sticky/
Comment 18 Sebastian Dröge (slomo) 2016-03-25 08:33:32 UTC
(In reply to Olivier Crête from comment #17)
> Review of attachment 324244 [details] [review] [review]:
> 
> I'm not sure how "ONCE" mode can ever be correct? If it sends them once,
> maybe it should merge things like the caps, so create a caps that intersects
> all incoming caps, and somehow merge the segments also, etc. and then have a
> MERGE mode?

Intersecting all the incoming caps will lead to empty caps unless they are all the same (or some are just missing fields) because caps are always fixed.

I think the use case here is application/x-rtp vs application/x-rtcp, where you don't want to switch all the time?
Comment 19 Olivier Crête 2016-03-25 18:13:06 UTC
Good point, maybe drop everything except for the stream start and a segment event and retimestamp to running time?
Comment 20 Miguel París Díaz 2016-03-28 06:30:03 UTC
Hello,
in our case we are using the funnel of the DtlsSrtpEnc bin and another for sending multiple RTP streams using an unique RtpSession.
In the last case we need that the funnel propagates the caps events in order to configure the internal RTPSources of the RtpSession.
Comment 21 Olivier Crête 2016-03-29 23:56:29 UTC
The dtlssrtpenc should just produce application/x-dtls and ignore incoming caps, as it will be a mix of DTLS and SRTP? And pretty much useless to any other element than a dtlssrtpdec.

Don't the internal RTPSources of the rtpsession on the send side read the content of the packets instead of the caps for the SSRC? And you get the clock rate from the signal?
Comment 22 Miguel París Díaz 2016-03-30 12:45:23 UTC
@oliver,the clock-rate is only got from the request_pt_map signal for the RECV side. See the [stack_trace_1]

But for the SEND side the clock-rate is got from the caps of the send_rtp_sink pad and if they are not set we can see this warning log:
WARN rtpsource rtpsource.c:1501:rtp_source_get_new_sr: no clock-rate, cannot interpolate rtp time. See the [stack_trace_2]

I tried to do a patch for getting the clock-rate using the request_pt_map signal, but I couldn't because I didn't find a way of getting the payload number in the rtp_source_get_new_sr function.

Refs:
[stack_trace_1]
gst_rtp_session_chain_recv_rtp (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/gstrtpsession.c#L1888)
rtp_session_process_rtp (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/rtpsession.c#L2099)
rtp_source_process_rtp (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/rtpsource.c#L1193)
calculate_jitter (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/rtpsource.c#L924)
get_clock_rate (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/rtpsource.c#L890)
source_clock_rate (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/rtpsession.c#L1385)
gst_rtp_session_clock_rate (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/gstrtpsession.c#L1588)
gst_rtp_session_get_caps_for_pt (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/gstrtpsession.c#L1535)

[stack_trace_2]
rtp_source_update_caps (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/rtpsource.c#L787)
rtp_session_update_send_caps (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/rtpsession.c#L2861)
gst_rtp_session_setcaps_send_rtp (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/gstrtpsession.c#L2240)
gst_rtp_session_event_send_rtp_sink (https://github.com/Kurento/gst-plugins-good/blob/1.7.1/gst/rtpmanager/gstrtpsession.c#L2063)
Comment 23 Olivier Crête 2016-04-04 09:19:36 UTC
I wonder if we shouldn't have a specialized RTP funnel that drops the encoding-name & pt, but just ensures that all sources have the same clock-rate and just forwards caps like: "application/x-rtp, clock-rate=XXX"
Comment 24 Olivier Crête 2016-04-04 09:21:04 UTC
Actually, forget what I just said, the rtpmuxer does that if you have only one SSRC, but if you have multiple SSRCs, you could have multiple clock rates (as you could be doing the bundle stuff), then sending through the caps won't work and you need to use the signal.
Comment 25 Sebastian Dröge (slomo) 2016-04-04 09:34:23 UTC
(In reply to Olivier Crête from comment #23)
> I wonder if we shouldn't have a specialized RTP funnel that drops the
> encoding-name & pt, but just ensures that all sources have the same
> clock-rate and just forwards caps like: "application/x-rtp, clock-rate=XXX"

You might also want to funnel RTP and RTCP together
Comment 26 Olivier Crête 2016-04-04 09:43:06 UTC
but funneling RTP & RTCP kind of requires dropping all the caps anyway. As picking a random one won't work.
Comment 27 GStreamer system administrator 2018-11-03 12:33:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/160.