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 764684 - adaptivedemux: Forward upstream buffer offsets
adaptivedemux: Forward upstream buffer offsets
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other All
: Normal enhancement
: 1.9.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-06 14:54 UTC by Sebastian Dröge (slomo)
Modified: 2016-07-01 12:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
adaptivedemux: Get rid of internal stream adapter and let subclasses handle this directly (18.20 KB, patch)
2016-04-06 14:54 UTC, Sebastian Dröge (slomo)
none Details | Review
hlsdemux: Clear pending data when needed (2.93 KB, patch)
2016-04-06 14:54 UTC, Sebastian Dröge (slomo)
none Details | Review
hlsdemux: Properly keep track of current offset (2.56 KB, patch)
2016-04-06 14:54 UTC, Sebastian Dröge (slomo)
none Details | Review
dashdemux: Properly keep track of current offset (8.28 KB, patch)
2016-04-06 14:54 UTC, Sebastian Dröge (slomo)
none Details | Review
dashdemux: Properly keep track of current offset (8.47 KB, patch)
2016-04-06 16:17 UTC, Sebastian Dröge (slomo)
none Details | Review
adaptivedemux: Get rid of internal stream adapter and let subclasses handle this directly (18.16 KB, patch)
2016-06-07 16:25 UTC, Sebastian Dröge (slomo)
committed Details | Review
hlsdemux: Clear pending data when needed (2.93 KB, patch)
2016-06-07 16:25 UTC, Sebastian Dröge (slomo)
committed Details | Review
hlsdemux: Properly keep track of current offset (2.56 KB, patch)
2016-06-07 16:25 UTC, Sebastian Dröge (slomo)
committed Details | Review
dashdemux: Properly keep track of current offset (8.46 KB, patch)
2016-06-07 16:25 UTC, Sebastian Dröge (slomo)
committed Details | Review
dashdemux: Implement SIDX tracking based on buffer offset (3.75 KB, patch)
2016-06-07 16:25 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Sebastian Dröge (slomo) 2016-04-06 14:54:21 UTC
This gives a more consistent picture of the structure of the data for
downstream, e.g. could be used by downstream to detect gaps in the media.

As a side-effect, also makes the hlsdemux code a bit easier to read and clears
per-fragment data when needed.
Comment 1 Sebastian Dröge (slomo) 2016-04-06 14:54:25 UTC
Created attachment 325482 [details] [review]
adaptivedemux: Get rid of internal stream adapter and let subclasses handle this directly

This allows subclasses to have more control and especially ensure that they
push data downstream with the correct offsets.
Comment 2 Sebastian Dröge (slomo) 2016-04-06 14:54:30 UTC
Created attachment 325483 [details] [review]
hlsdemux: Clear pending data when needed

When switching fragments we don't want to keep any data around from the last
one, and also forget about all data when doing flushing seeks or selecting new
bitrates.
Comment 3 Sebastian Dröge (slomo) 2016-04-06 14:54:35 UTC
Created attachment 325484 [details] [review]
hlsdemux: Properly keep track of current offset

GstAdapter does not guarantee to pass through all the offsets, we have to keep
track of it ourselves.
Comment 4 Sebastian Dröge (slomo) 2016-04-06 14:54:40 UTC
Created attachment 325485 [details] [review]
dashdemux: Properly keep track of current offset

GstAdapter does not guarantee to pass through all the offsets, we have to keep
track of it ourselves.
Comment 5 Sebastian Dröge (slomo) 2016-04-06 16:17:35 UTC
Created attachment 325494 [details] [review]
dashdemux: Properly keep track of current offset

GstAdapter does not guarantee to pass through all the offsets, we have to keep
track of it ourselves.
Comment 6 Sebastian Dröge (slomo) 2016-05-19 07:53:58 UTC
How should we proceed with this? The goal here is that downstream of e.g. dashdemux can know where in the stream it is, and then can e.g. handle gaps in the stream (if adaptivedemux e.g. decides to only download and output I-frames).

Patches for that are also in the works :)
Comment 7 Thiago Sousa Santos 2016-05-19 09:10:22 UTC
Is this related to https://bugzilla.gnome.org/show_bug.cgi?id=766647 ?

Does this offset also include headers/indexes or is it only about the stream payload?

(In reply to Sebastian Dröge (slomo) from comment #6)
> How should we proceed with this? The goal here is that downstream of e.g.
> dashdemux can know where in the stream it is, and then can e.g. handle gaps
> in the stream (if adaptivedemux e.g. decides to only download and output
> I-frames).
> 
> Patches for that are also in the works :)

Shouldn't this be handled by using the DISCONT flag? What is the use case to knowing exactly the byte offset of the data other than detecting disconts?
Comment 8 Sebastian Dröge (slomo) 2016-05-19 09:21:05 UTC
(In reply to Thiago Sousa Santos from comment #7)
> Is this related to https://bugzilla.gnome.org/show_bug.cgi?id=766647 ?
> 
> Does this offset also include headers/indexes or is it only about the stream
> payload?

I only care about consistent offsets inside a single fragment :) The code however just passes through the offsets that come from souphttpsrc.

> (In reply to Sebastian Dröge (slomo) from comment #6)
> > How should we proceed with this? The goal here is that downstream of e.g.
> > dashdemux can know where in the stream it is, and then can e.g. handle gaps
> > in the stream (if adaptivedemux e.g. decides to only download and output
> > I-frames).
> > 
> > Patches for that are also in the works :)
> 
> Shouldn't this be handled by using the DISCONT flag? What is the use case to
> knowing exactly the byte offset of the data other than detecting disconts?

You split a single fragment into "virtual" fragments per I-frame (similar to what the sidx mode does with the individual moof already). And then omit everything in between. However the demuxer needs to be able to know to which sample inside the moof the current buffer belongs, and can correlate that with the buffer offset now.
Comment 9 Sebastian Dröge (slomo) 2016-06-07 16:25:20 UTC
Created attachment 329305 [details] [review]
adaptivedemux: Get rid of internal stream adapter and let subclasses handle this directly

This allows subclasses to have more control and especially ensure that they
push data downstream with the correct offsets.
Comment 10 Sebastian Dröge (slomo) 2016-06-07 16:25:25 UTC
Created attachment 329306 [details] [review]
hlsdemux: Clear pending data when needed

When switching fragments we don't want to keep any data around from the last
one, and also forget about all data when doing flushing seeks or selecting new
bitrates.
Comment 11 Sebastian Dröge (slomo) 2016-06-07 16:25:31 UTC
Created attachment 329307 [details] [review]
hlsdemux: Properly keep track of current offset

GstAdapter does not guarantee to pass through all the offsets, we have to keep
track of it ourselves.
Comment 12 Sebastian Dröge (slomo) 2016-06-07 16:25:36 UTC
Created attachment 329308 [details] [review]
dashdemux: Properly keep track of current offset

GstAdapter does not guarantee to pass through all the offsets, we have to keep
track of it ourselves.
Comment 13 Sebastian Dröge (slomo) 2016-06-07 16:25:41 UTC
Created attachment 329309 [details] [review]
dashdemux: Implement SIDX tracking based on buffer offset

This simplifies the code but also removes a bug with tracking of the remaining
size for the initial subfragment: we were not considering the size between the
index and the start of the first moof here.
Comment 14 Sebastian Dröge (slomo) 2016-07-01 12:10:53 UTC
Attachment 329305 [details] pushed as ca9f62e - adaptivedemux: Get rid of internal stream adapter and let subclasses handle this directly
Attachment 329306 [details] pushed as 3469104 - hlsdemux: Clear pending data when needed
Attachment 329307 [details] pushed as 8344854 - hlsdemux: Properly keep track of current offset
Attachment 329308 [details] pushed as 9374643 - dashdemux: Properly keep track of current offset
Attachment 329309 [details] pushed as 91e398d - dashdemux: Implement SIDX tracking based on buffer offset