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 723868 - adaptivedemux: Handle users _eos event
adaptivedemux: Handle users _eos event
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 769297 784338 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-02-07 18:41 UTC by Thibault Saunier
Modified: 2018-11-03 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
adaptivedemux: Allow application to force EOS (2.87 KB, patch)
2017-07-03 19:32 UTC, Nicolas Dufresne (ndufresne)
none Details | Review
adaptivedemux: Allow application to force EOS (6.27 KB, patch)
2017-07-03 20:26 UTC, Nicolas Dufresne (ndufresne)
needs-work Details | Review

Description Thibault Saunier 2014-02-07 18:41:08 UTC
Currently if the user sends an EOS to a pipeline with hlsdemux in it, it will basically be ignored, we should manage to detect when an EOS as been sent by the user itself, and properly handle it.
Comment 1 Thiago Sousa Santos 2014-02-13 02:21:34 UTC
Can you elaborate on the use case? Sending EOS to the pipeline will be ignored because hlsdemux already received an EOS from upstream when the playlist file finished.
Comment 2 Thibault Saunier 2014-02-13 08:32:39 UTC
For example to produce valid files when transcoding into mp4 from an HLS stream you need EOS to be properly sent downstream before stopping the pipeline.
Comment 3 Thiago Sousa Santos 2014-02-13 15:58:16 UTC
(In reply to comment #2)
> For example to produce valid files when transcoding into mp4 from an HLS stream
> you need EOS to be properly sent downstream before stopping the pipeline.

I'm assuming you want it to finish on some user interaction as it should EOS properly once the stream ends. Right?
Comment 4 Sebastian Dröge (slomo) 2014-05-26 13:02:35 UTC
Not sure how to fix this. The source and upstream of hlsdemux is already EOS, sending an EOS event to the pipeline will send it to all sources. So hlsdemux never gets anything in this situation.
Comment 5 Tim-Philipp Müller 2016-07-17 18:20:39 UTC
hlsdemux/adaptivedemux could flush-start/stop upstream after receiving the initial EOS. Then we'd just need to make basesrc push a forced EOS event through directly if the task is already pause for some reason (made a patch for that to try it, seems to work).

Only problem is that there's no upstream flush-stop, so we can't flush-stop without upstream source's co-operation.

Alternatively, maybe adaptivedemux could just do a flushing seek with start=stop=0 and FLAG_SEGMENT after receiving EOS (from a non-streaming thread of course), to fire up the basesrc thread again and make it do the flush-start/stop dance without sending anything else or going EOS thus keeping the path open for a second EOS.
Comment 6 Edward Hervey 2016-08-13 14:44:11 UTC
*** Bug 769297 has been marked as a duplicate of this bug. ***
Comment 7 Sebastian Dröge (slomo) 2017-06-29 20:36:06 UTC
*** Bug 784338 has been marked as a duplicate of this bug. ***
Comment 8 Nicolas Dufresne (ndufresne) 2017-06-29 21:05:23 UTC
As described in bug 784338, a third option is to set the SOURCE flag on the fragmenteddemux element and implement a handler for the EOS.
Comment 9 Nicolas Dufresne (ndufresne) 2017-07-03 19:32:31 UTC
Created attachment 354854 [details] [review]
adaptivedemux: Allow application to force EOS

Adaptive demuxers are special demuxers that runs their own sources
internally. In this patch we flag the demuxer as being a source in order
to receive the downstream events. We then handle the EOS event by
resetting the internal state and pushing EOS on all pads.

https://bugzilla.gnome.org/show_bug.cgi?id=784338
Comment 10 Nicolas Dufresne (ndufresne) 2017-07-03 19:34:01 UTC
Just a note, while this patch works, I just notice I forgot that send_event for EOS shall be asynchonous. I'll revisit later to find out how we can do that, right now it blocks the user thread for quite some time.
Comment 11 Nicolas Dufresne (ndufresne) 2017-07-03 19:50:38 UTC
Review of attachment 354854 [details] [review]:

::: gst-libs/gst/adaptivedemux/gstadaptivedemux.c
@@ +610,3 @@
+
+    GST_MANIFEST_LOCK (demux);
+    gst_adaptive_demux_reset (demux);

This function sends EOS on all pads already, so the later chaining to bin default implementation is redundant. Though, the EOS has the wrong segnum. This also means that calling reset need to be queued somehow.
Comment 12 Nicolas Dufresne (ndufresne) 2017-07-03 20:26:13 UTC
Created attachment 354855 [details] [review]
adaptivedemux: Allow application to force EOS

Adaptive demuxers are special demuxers that runs their own sources
internally. In this patch we flag the demuxer as being a source in order
to receive the downstream events. We then handle the EOS event by
resetting the internal state and pushing EOS on all pads. This handling
is done asynchronously to avoid blocking user thread.
Comment 13 Nicolas Dufresne (ndufresne) 2017-07-07 18:36:59 UTC
Attachment 354855 [details] pushed as 8a070cf - adaptivedemux: Allow application to force EOS
Comment 14 Nicolas Dufresne (ndufresne) 2017-07-07 21:22:12 UTC
Comment on attachment 354855 [details] [review]
adaptivedemux: Allow application to force EOS

I've pushed this one slightly by accident, and validate showed that it's not ready yet. So it's now reverted, sorry for the noise.

commit 2f8980d70d7e56463bcebe46f092648a8231bdbc
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Fri Jul 7 17:20:38 2017 -0400

    Revert "adaptivedemux: Allow application to force EOS"
    
    This reverts commit 8a070cf9aff8a122b1a52597441bab61c0476ef9.
Comment 15 GStreamer system administrator 2018-11-03 13:21:04 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/gst-plugins-bad/issues/132.