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 744469 - tsdemux: No data after prerolling when different PTS in one program
tsdemux: No data after prerolling when different PTS in one program
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 1.14.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-13 12:59 UTC by Andreas Schuler
Modified: 2018-05-14 14:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
not working stream (1.56 MB, application/octet-stream)
2015-02-13 13:04 UTC, Andreas Schuler
  Details
working stream (1.56 MB, application/octet-stream)
2015-02-13 13:05 UTC, Andreas Schuler
  Details
tsdemux: ignore sparse stream when checking for initial timestamp (2.14 KB, patch)
2015-03-16 17:16 UTC, Aurélien Zanelli
none Details | Review

Description Andreas Schuler 2015-02-13 12:59:58 UTC
When tsdemux shall demux a program with streams that have different pts, sometimes there are non data output after prerolling phase. Results in non playing pipelines.

It's simple to test with the commands:
filesrc location=phoenix_tail_425.ts ! tsparse ! tsdemux name=dm dm. ! identity dump=true ! mpegvideoparse ! fakesink
filesrc location=phoenix_tail_425.ts ! tsparse ! tsdemux name=dm dm. ! identity dump=true ! mpegaudioparse ! fakesink

The bug is triggert only sometimes, when the stream with bigger(?) PTS is first found. As attachement one stream which triggers the bug(425) and another one that differs only in that, that the first packet is removed(426). With the second it works perfectly.

The problematic stream is the private stream. When I patch tsdemux to ignore private streams it works with both.
Comment 1 Andreas Schuler 2015-02-13 13:04:38 UTC
Created attachment 296776 [details]
not working stream
Comment 2 Andreas Schuler 2015-02-13 13:05:04 UTC
Created attachment 296777 [details]
working stream
Comment 3 Aurélien Zanelli 2015-03-16 17:15:11 UTC
Since I have the same issue with some others streams, I take a look at this issue.
My current understanding is that the first observed valid timestamp in PES header will trigger the initial PTS/DTS set on all streams. Unfortunately in this case the first stream which have a valid timestamp is the subtitle one (teletext) which have a really big timestamp (something like 13 hours). So when check_pending_buffers() is called, the only stream which have a valid timestamp is this one, leading the following segment logic to choose it as a start value.

So in this case the tsdemux ouputs a segment which have ~ 13:00:00 as a start value on all source pad. As a result, when tsdemux pushes audio/video samples with lower timestamp, they are clipped because they are outside of segments.

Currently, I'm not very familiar with MPEG-TS and tsdemux but I'm thinking of two solutions:
- ignore sparse streams when checking for initial valid timestamp unless we only have sparse stream; (i will suubmit a patch for this way)
- when first timestamp of each stream is valid, trigger a new check and adjust segment.

What do you think about it ?
Comment 4 Aurélien Zanelli 2015-03-16 17:16:50 UTC
Created attachment 299536 [details] [review]
tsdemux: ignore sparse stream when checking for initial timestamp

Proposal fix/workaround for this issue.

It ignores sparse streams for initial timestamp unless we only have sparse stream.

It may be not the best solution but it can be a first try to solve this issue.
Comment 5 Jan Schmidt 2018-05-04 13:05:42 UTC
Thanks for the patch. Pushed:

commit 89a85732d4d91ea6b41e3ea85fdf96152bc58e8d (HEAD -> master)
Author: Aurélien Zanelli <aurelien.zanelli@parrot.com>
Date:   Mon Mar 16 16:20:44 2015 +0100

    tsdemux: ignore sparse stream when checking for initial timestamp
    
    Unless we only have sparse streams. In this case we will consider them.
    It fixes a bug happening when first observed timestamp comes from a
    sparse stream and other streams don't have a valid timestamp, yet. Thus
    leading the timestamp from sparse stream to be the start of the
    following segment. In this case, if the timestamp is really bigger than
    non-sparse stream (audio/video), it will lead the pipeline to clip
    samples from the non-parse stream.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744469