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 783075 - adaptivedemux: Check live seeking range more often
adaptivedemux: Check live seeking range more often
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other All
: Normal blocker
: 1.12.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 784510
 
 
Reported: 2017-05-25 07:51 UTC by Edward Hervey
Modified: 2017-07-13 12:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
adaptivedemux: Check live seeking range more often (3.27 KB, patch)
2017-05-25 07:52 UTC, Edward Hervey
committed Details | Review
adaptivedemux: Workaround for live seek ranges when advancing (2.82 KB, patch)
2017-07-13 11:08 UTC, Edward Hervey
committed Details | Review

Description Edward Hervey 2017-05-25 07:51:59 UTC
See patch
Comment 1 Edward Hervey 2017-05-25 07:52:04 UTC
Created attachment 352556 [details] [review]
adaptivedemux: Check live seeking range more often

The live seeking range was only checked when doing actual seeks. This was
assuming that the rate would always be 1.0 (i.e. the playback would
advance in realtime, and therefore fragments would always be available
since the seeking window moves at the same rate).

With non-1.0 rates, this no longer becomes valid, and therefore we need
to check whether we are still within the live seeking range when advancing.
Comment 2 Sebastian Dröge (slomo) 2017-05-25 09:28:21 UTC
Review of attachment 352556 [details] [review]:

::: gst-libs/gst/adaptivedemux/gstadaptivedemux.c
@@ +4145,3 @@
+  if (demux->segment.rate != 1.0 && gst_adaptive_demux_is_live (demux)) {
+    if (!gst_adaptive_demux_stream_in_live_seek_range (demux, stream))
+      ret = GST_FLOW_EOS;

Instead of EOS, maybe waiting until the segment becomes available is a better behaviour?
Comment 3 Edward Hervey 2017-05-25 14:17:39 UTC
Review of attachment 352556 [details] [review]:

::: gst-libs/gst/adaptivedemux/gstadaptivedemux.c
@@ +4145,3 @@
+  if (demux->segment.rate != 1.0 && gst_adaptive_demux_is_live (demux)) {
+    if (!gst_adaptive_demux_stream_in_live_seek_range (demux, stream))
+      ret = GST_FLOW_EOS;

How so ?

* If you're doing negative rates it's not going to help (you're already outside of the seek range and it's not going to ever go backwards).
* If you're doing positive rates ... you're not playing at the same speed at which the "live" position (and therefore seekable range) moves anyway. Would you want it to constantly buffer/pause ?
Comment 4 Sebastian Dröge (slomo) 2017-05-26 11:58:49 UTC
That's what I would expect yes. It's also not ideal though, so I guess it doesn't really matter in the end :)
Comment 5 Edward Hervey 2017-05-26 13:05:38 UTC
commit f4190a49c04f1d5d174cebba0bc9a03a7ec721c2
Author: Edward Hervey <edward@centricular.com>
Date:   Thu May 25 09:48:53 2017 +0200

    adaptivedemux: Check live seeking range more often
    
    The live seeking range was only checked when doing actual seeks. This was
    assuming that the rate would always be 1.0 (i.e. the playback would
    advance in realtime, and therefore fragments would always be available
    since the seeking window moves at the same rate).
    
    With non-1.0 rates, this no longer becomes valid, and therefore we need
    to check whether we are still within the live seeking range when advancing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783075
Comment 6 Edward Hervey 2017-07-13 10:01:57 UTC
This introduces a regression as shown in https://bugzilla.gnome.org/show_bug.cgi?id=784510
Comment 7 Edward Hervey 2017-07-13 10:41:40 UTC
I did a wrong assumption with this. I assumed that seek_range for a live stream would be a continuously moving window, which is not always the case (for DASH it is, for HLS it's not).
Comment 8 Edward Hervey 2017-07-13 11:08:01 UTC
Created attachment 355502 [details] [review]
adaptivedemux: Workaround for live seek ranges when advancing

This is a workaround for a regression introduced by
f4190a49c04f1d5d174cebba0bc9a03a7ec721c2
 ( adaptivedemux: Check live seeking range more often )

The goal of the previous commit was to be able to cope with non-1.0
rates on live streams which have a "seeking window" (i.e. the server
keeps around quite a bit of the live stream so you can seek back into
it).

Without that commit, two different kind of issues would happen:
* When doing reverse playback, you would never check whether you
  are outside of the seekable region. And would then continuously
  try to download fragments that are no longer present.
* When doing fast forward, you would end up requesting fragments
  which are not present yet.

In order to determine whether one was *really* outside of the seekable
window, we check whether the current stream position is still
within the seekable region.

The *problem* though with that commit is that it assumes that subclasses
will return continuously updated seeking ranges (i.e. dependent on the
current time), which is *NOT* the case.

For example:
* dashdemux does use the current UTC to determine the seekable region
* hlsdemux uses the values from the last updated manifest

Therefore if one downloads fragments faster than realtime, for HLS
we would end up at the end of the last manifest seekable range, and
the previous commit would consider the stream as being ended... which
is not the case.

In the long run, we need to figure out a way to cope with non-1.0
rates on live streams for all types of stream (including HLS).
Comment 9 Edward Hervey 2017-07-13 12:46:06 UTC
Pushed to both master and 1.12

commit 50f92fab89893246f309680bdbdc336cbce38100
Author: Edward Hervey <edward@centricular.com>
Date:   Thu Jul 13 12:57:12 2017 +0200

    adaptivedemux: Workaround for live seek ranges when advancing
    
    This is a workaround for a regression introduced by
    f4190a49c04f1d5d174cebba0bc9a03a7ec721c2
     ( adaptivedemux: Check live seeking range more often )
    
    The goal of the previous commit was to be able to cope with non-1.0
    rates on live streams which have a "seeking window" (i.e. the server
    keeps around quite a bit of the live stream so you can seek back into
    it).
    
    Without that commit, two different kind of issues would happen:
    * When doing reverse playback, you would never check whether you
      are outside of the seekable region. And would then continuously
      try to download fragments that are no longer present.
    * When doing fast forward, you would end up requesting fragments
      which are not present yet.
    
    In order to determine whether one was *really* outside of the seekable
    window, we check whether the current stream position is still
    within the seekable region.
    
    The *problem* though with that commit is that it assumes that subclasses
    will return continuously updated seeking ranges (i.e. dependent on the
    current time), which is *NOT* the case.
    
    For example:
    * dashdemux does use the current UTC to determine the seekable region
    * hlsdemux uses the values from the last updated manifest
    
    Therefore if one downloads fragments faster than realtime, for HLS
    we would end up at the end of the last manifest seekable range, and
    the previous commit would consider the stream as being ended... which
    is not the case.
    
    In the long run, we need to figure out a way to cope with non-1.0
    rates on live streams for all types of stream (including HLS).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783075