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 779011 - hlsdemux: Try to find type at the end of a fragment
hlsdemux: Try to find type at the end of a fragment
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.11.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-21 11:47 UTC by Seungha Yang
Modified: 2017-10-16 10:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
hlsdemux: Try to find type at the end of a fragment (1.28 KB, patch)
2017-02-21 11:48 UTC, Seungha Yang
committed Details | Review
hlsdemux: Expose all type of rendition streams (1.03 KB, patch)
2017-03-05 05:41 UTC, Seungha Yang
needs-work Details | Review

Description Seungha Yang 2017-02-21 11:47:47 UTC
hlsdemux tries to find type if given buffer size is large enought to
find type (currently the threshold is 2KB), or EOS in some cases.
However, since there can be small byte fragments such as WebVTT,
demux should try to find type at the end of a fragment
Comment 1 Seungha Yang 2017-02-21 11:48:29 UTC
Created attachment 346314 [details] [review]
hlsdemux: Try to find type at the end of a fragment
Comment 2 Sebastian Dröge (slomo) 2017-03-02 18:19:55 UTC
Comment on attachment 346314 [details] [review]
hlsdemux: Try to find type at the end of a fragment

Can you provide a example stream for this? And why doesn't this find the type while buffers are arriving, but finds it on finish then? Isn't it looking at exactly the same data?
Comment 3 Tim-Philipp Müller 2017-03-03 09:37:37 UTC
> And why doesn't this find the type while buffers are arriving,
> but finds it on finish then? Isn't it looking at exactly the
> same data?

As I understand it, it doesn't find the type while buffers are arriving because it doesn't even attempt to do any typefinding yet there. When the data is very small (<2 kB), this

    /* Typefind could miss if buffer is too small. In this case we
     * will retry later */
    if (buffer_size >= (2 * 1024) || at_eos) {
      caps =
          gst_type_find_helper_for_data (GST_OBJECT_CAST (hlsdemux), info.data,
          info.size, &prob);
    }

will never run.

I think the patch makes sense.
Comment 4 Sebastian Dröge (slomo) 2017-03-03 10:09:04 UTC
Yes, that makes sense then. Having an example stream would still be useful though :)
Comment 5 Seungha Yang 2017-03-05 05:41:01 UTC
Created attachment 347252 [details] [review]
hlsdemux: Expose all type of rendition streams

Not only audio and video, allow exposing subtitle/closed-caption streams
Comment 6 Seungha Yang 2017-03-05 05:45:31 UTC
(In reply to Sebastian Dröge (slomo) from comment #4)
> Yes, that makes sense then. Having an example stream would still be useful
> though :)

This is the test stream provided by Apple.
http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8

Additionally, we need attachment 347252 [details] [review] to enable WebVTT subtitle. Anyway, we can remove the code for blocking subtitle streams now, since WebVTT parser has been implemented in subparse element.
Comment 7 Jan Schmidt 2017-03-06 01:32:10 UTC
There is another reason WebVTT is disabled by default - with playbin2 they cause playback stalls at bitrate switching time.

The problem is that decodebin2 wants to switch to a new decode chain when switching bitrate, but gets stuck waiting for the webVTT stream to EOS - which it never does if the video stream finished already, as it's blocked downstream waiting for video to advance. Video won't advance until the new bitrate stream starts sending data.... which it can't do because decodebin has blocked it waiting for the old bitrate to finish.

We can only enable WebVTT when we know it's OK to switch out streams on-the-fly. For that, we need to only enable them when requested by a stream-selection event. We should implement it that way.
Comment 8 Sebastian Dröge (slomo) 2017-03-06 08:08:44 UTC
Comment on attachment 347252 [details] [review]
hlsdemux: Expose all type of rendition streams

Let's put this into a new bug then
Comment 9 Sebastian Dröge (slomo) 2017-03-06 08:09:35 UTC
Attachment 346314 [details] pushed as 3c5eae6 - hlsdemux: Try to find type at the end of a fragment
Comment 10 CARD 2017-10-16 10:00:45 UTC
(In reply to Jan Schmidt from comment #7)
> There is another reason WebVTT is disabled by default - with playbin2 they
> cause playback stalls at bitrate switching time.
> 
> The problem is that decodebin2 wants to switch to a new decode chain when
> switching bitrate, but gets stuck waiting for the webVTT stream to EOS -
> which it never does if the video stream finished already, as it's blocked
> downstream waiting for video to advance. Video won't advance until the new
> bitrate stream starts sending data.... which it can't do because decodebin
> has blocked it waiting for the old bitrate to finish.
> 
> We can only enable WebVTT when we know it's OK to switch out streams
> on-the-fly. For that, we need to only enable them when requested by a
> stream-selection event. We should implement it that way.

Hi,as you say " For that, we need to only enable them when requested by a stream-selection event...."
When we select stream bitrate how we implement WebVTT?
Is it in the function of "gst_hls_demux_select_bitrate(GstAdaptiveDemuxStream * stream, guint64 bitrate)"?