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 706441 - adder: Rework/review the way we handle flushing
adder: Rework/review the way we handle flushing
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.x
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 708416
Blocks:
 
 
Reported: 2013-08-20 20:09 UTC by Thibault Saunier
Modified: 2014-11-16 17:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fixes quite a few issue we have been (1.23 KB, patch)
2013-08-20 20:13 UTC, Mathieu Duponchelle
committed Details | Review
adder: Rework the way we handle flushes and flushing seeks (14.09 KB, patch)
2013-09-11 23:31 UTC, Thibault Saunier
none Details | Review
adder: Rework the way we handle flushes and flushing seeks (11.35 KB, patch)
2013-09-17 23:10 UTC, Thibault Saunier
none Details | Review

Description Thibault Saunier 2013-08-20 20:09:11 UTC
We have been quite a few issue with the current implementation of the flush handling in videomixer (most of those also apply to adder btw) and we should review it and rework it once for all instead of keeping adding stuff around to fix issues as they come if needed.

Currently we have the following code:

 * When getting a flushing seek, we set flush_stop_pending=TRUE which means that the next time collectpad->collected is called, we send a flush_stop ourself before pushing a buffer.

  * When we get a flush_start, we set waiting_flush_stop and we forward the flush_stop once and set that variable back to FALSE.

Also there is a bug where we send 2 times flush_stop Mathieu Duponchelle has a patch for it.
Comment 1 Mathieu Duponchelle 2013-08-20 20:13:41 UTC
Created attachment 252471 [details] [review]
fixes quite a few issue we have been
Comment 2 Sebastian Dröge (slomo) 2013-08-21 06:58:34 UTC
I think this should work the following way:

1) flush-start/flush-stop received from upstream without a pending seek: Reset the GstVideoMixer2Pad segment on flush-stop and don't forward anything downstream. Never.

2) flush-start/flush-stop received from downstream: Reset on flush-stop and forward upstream

3) flushing seek: Forward to all upstreams, don't send flush-start/stop ourselves downstream. Forward the *first* flush-start and flush-stop that happens because of the seek, drop all others. Reset the GstVideoMixer2Pad segment when receiving the flush-stops (all of them for the corresponding pad).
Comment 3 Sebastian Dröge (slomo) 2013-08-26 08:45:44 UTC
Also see bug #706779, same issue in oggmux.
Comment 4 Sebastian Dröge (slomo) 2013-08-26 08:46:02 UTC
Comment on attachment 252471 [details] [review]
fixes quite a few issue we have been

This was committed already
Comment 5 Alessandro Decina 2013-08-27 20:09:24 UTC
(In reply to comment #2)
> I think this should work the following way:
>
> 
> 3) flushing seek: Forward to all upstreams, don't send flush-start/stop
> ourselves downstream. Forward the *first* flush-start and flush-stop that
> happens because of the seek, drop all others. Reset the GstVideoMixer2Pad
> segment when receiving the flush-stops (all of them for the corresponding pad).

Isn't this racy if you have two upstreams where the 1st flushes, sending flush start/stop and the 2nd still sends some data belonging to the old segment after the 1st has sent flush_stop (and flush_stop has been propagated downstream)?
Comment 6 Sebastian Dröge (slomo) 2013-08-30 10:17:57 UTC
It is, new solution that shouldn't be racy is in bug #706779
Comment 7 Thibault Saunier 2013-09-11 23:31:39 UTC
Created attachment 254746 [details] [review]
adder: Rework the way we handle flushes and flushing seeks
Comment 8 Thibault Saunier 2013-09-11 23:34:22 UTC
OK, this one was about adder and is not finnished, but I wanted to check if it corresponds to what you have in mind?

Also there are still some races in that patch, it is just a first version and I wanted to see if you have ideas about what is wrong etc... with that basis.
Comment 9 Thibault Saunier 2013-09-17 23:10:39 UTC
Created attachment 255147 [details] [review]
adder: Rework the way we handle flushes and flushing seeks

The new strategy is that we forward dowstream flush_stop only once and
that after seeking.

We now always forward flush start and stop comming from dowstream to all our
upstream pads

We flush ourself right when receiving a flushing seek and send
flush_start downstream to make sue the collectpad is flushing and we
can send our seek events without fearing to get collected call
meanwhile.
Comment 10 Thibault Saunier 2013-09-17 23:13:18 UTC
Comment on attachment 252471 [details] [review]
fixes quite a few issue we have been

Merged
Comment 11 Edward Hervey 2013-09-27 09:13:36 UTC
Review of attachment 255147 [details] [review]:

::: tests/check/elements/adder.c
@@ +1235,3 @@
   adder_src = gst_element_get_static_pad (adder, "src");
   fail_if (GST_PAD_IS_FLUSHING (adder_src));
+  gst_pad_send_event (adder_src, gst_event_new_flush_start ());

you're changing the nature of this test with this.

Shouldn't you add a different unit test ?
Comment 12 Thibault Saunier 2013-09-27 09:18:48 UTC
(In reply to comment #11)
> Review of attachment 255147 [details] [review]:
> 
> ::: tests/check/elements/adder.c
> @@ +1235,3 @@
>    adder_src = gst_element_get_static_pad (adder, "src");
>    fail_if (GST_PAD_IS_FLUSHING (adder_src));
> +  gst_pad_send_event (adder_src, gst_event_new_flush_start ());
> 
> you're changing the nature of this test with this.

I actually changed the behaviour of Adder concerning flush event comming from upstream, as now, I do not foward dowstream them unless they are coming from the result of a flushing seek. That test doesn't make sense anymore in that new context.
 
> Shouldn't you add a different unit test ?
Comment 13 Edward Hervey 2013-09-27 09:24:03 UTC
What if the seek event went through another branch ? You're not guaranteed you'll see the seek event.



tee -- adder1 -- sink
  \----adder2 -- sink
Comment 14 Thibault Saunier 2013-09-27 09:46:55 UTC
Btw, this patch should no be merged anyway as this is now implemented in collectpads directly.
Comment 15 Thibault Saunier 2013-10-04 15:46:40 UTC
(In reply to comment #13)
> What if the seek event went through another branch ? You're not guaranteed
> you'll see the seek event.
> 
> 
> 
> tee -- adder1 -- sink
>   \----adder2 -- sink

In that particular case, the flush should no be forwarded on the branch where the seek did not happen I would say.

If we seek on the adder2 branch, the flushes should be only forwarded to adder2 not adder 1.
Comment 16 Sebastian Dröge (slomo) 2013-10-07 11:45:44 UTC
I disagree, if you would do it that way the non-flushed branches of tee would get wrong running times.
Comment 17 Thibault Saunier 2014-11-16 16:01:04 UTC
Should that bug simply be closed as OBSELETE now that we have audiomixer?
Comment 18 Tim-Philipp Müller 2014-11-16 16:08:01 UTC
WONTFIX or OBSOLETE seems best to me. I think it's difficult to change adder anyway because of the way it handles (or didn't handle) timestamps etc.
Comment 19 Thibault Saunier 2014-11-16 17:00:19 UTC
Wontfix it is.