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 756507 - multiqueue: Use buffer DTS if present, else PTS
multiqueue: Use buffer DTS if present, else PTS
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other All
: Normal normal
: 1.7.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-10-13 15:23 UTC by Edward Hervey
Modified: 2015-10-27 15:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
multiqueue: Use buffer DTS if present, else PTS (3.64 KB, patch)
2015-10-13 15:23 UTC, Edward Hervey
reviewed Details | Review
multiqueue: Use buffer DTS if present, else PTS (3.34 KB, patch)
2015-10-27 07:49 UTC, Edward Hervey
committed Details | Review
queue/queue2: Use GST_BUFFER_DTS_OR_PTS (3.64 KB, patch)
2015-10-27 07:49 UTC, Edward Hervey
committed Details | Review

Description Edward Hervey 2015-10-13 15:23:26 UTC
See comment
Comment 1 Edward Hervey 2015-10-13 15:23:32 UTC
Created attachment 313196 [details] [review]
multiqueue: Use buffer DTS if present, else PTS

In order to accurately determine the amount (in time) of data
travelling in queues, we should use an increasing value.

If buffers are encoded and potentially reordered, we should be
using their DTS (increasing) and not PTS (reordered)
Comment 2 Sebastian Dröge (slomo) 2015-10-13 15:29:26 UTC
Makes sense to me and matches basesink behaviour. Should probably do the same in other queue-like elements for fill level.

What would this do if a stream sometimes has DTS and sometimes PTS? Might it causes confusion?
Comment 3 Edward Hervey 2015-10-14 06:39:46 UTC
(In reply to Sebastian Dröge (slomo) from comment #2)
> Makes sense to me and matches basesink behaviour. Should probably do the
> same in other queue-like elements for fill level.

  Indeed. If this patch is ok, then the other queue-like elements should be fixed accordingly.

> 
> What would this do if a stream sometimes has DTS and sometimes PTS? Might it
> causes confusion?

  This could very well happen, like when PTS == DTS, some formats only set PTS. But that's fine.
  I'm more worried of decoders (maybe) not removing the DTS on the output buffer. Or any elements producing properly-ordered output. That could cause serious confusion.
Comment 4 Nicolas Dufresne (ndufresne) 2015-10-14 09:12:01 UTC
When you decode to raw, the end result should have just PTS (PTS == DTS is also fine, but when I come across those, I usually fix it). Leaving trace of the DTS would be a bug.
Comment 5 Nicolas Dufresne (ndufresne) 2015-10-14 09:18:26 UTC
Review of attachment 313196 [details] [review]:

::: plugins/elements/gstmultiqueue.c
@@ +1157,3 @@
   if (GST_IS_BUFFER (object)) {
     GstBuffer *buf = GST_BUFFER_CAST (object);
+    GstClockTime ptime = GST_BUFFER_DTS (buf);

Nitpick, but ptime sounds like presentation time, a confusing variable name when the first thing you do it set it to DTS. Maybe, timestamp could be better ?

@@ +1166,3 @@
+      if (ptime > segment->stop)
+        ptime = segment->stop;
+      time = gst_segment_to_running_time (segment, GST_FORMAT_TIME, ptime);

As we move toward DTS, I think we need negative TS support here. I suggest turning time into a gint64, and storing a signed version of the running time (optained using the _full method).
Comment 6 Edward Hervey 2015-10-27 07:49:15 UTC
Created attachment 314189 [details] [review]
multiqueue: Use buffer DTS if present, else PTS

In order to accurately determine the amount (in time) of data
travelling in queues, we should use an increasing value.

If buffers are encoded and potentially reordered, we should be
using their DTS (increasing) and not PTS (reordered)
Comment 7 Edward Hervey 2015-10-27 07:49:22 UTC
Created attachment 314190 [details] [review]
queue/queue2: Use GST_BUFFER_DTS_OR_PTS

The input of queue/queue2 might have DTS set, in which cas we want
to take that into account (instead of the PTS) to calculate position
and queue levels.
Comment 8 Edward Hervey 2015-10-27 07:50:16 UTC
The switch to handling negative ts can be done in a later step. It still seems quite confusing.
Comment 9 Edward Hervey 2015-10-27 11:17:37 UTC
commit a9c923d585affc85262e41b4790d378294706d7a
Author: Edward Hervey <bilboed@bilboed.com>
Date:   Tue Oct 27 08:48:07 2015 +0100

    queue/queue2: Use GST_BUFFER_DTS_OR_PTS
    
    The input of queue/queue2 might have DTS set, in which cas we want
    to take that into account (instead of the PTS) to calculate position
    and queue levels.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756507

commit 692c0dc060807fd1ea813aa81e9c2656fd607b40
Author: Edward Hervey <edward@centricular.com>
Date:   Tue Oct 13 17:20:26 2015 +0200

    multiqueue: Use buffer DTS if present, else PTS
    
    In order to accurately determine the amount (in time) of data
    travelling in queues, we should use an increasing value.
    
    If buffers are encoded and potentially reordered, we should be
    using their DTS (increasing) and not PTS (reordered)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756507
Comment 10 Nicolas Dufresne (ndufresne) 2015-10-27 13:10:11 UTC
Please leave open until it's fully implemented.
Comment 11 Nicolas Dufresne (ndufresne) 2015-10-27 13:11:54 UTC
(In reply to Edward Hervey from comment #8)
> It still seems quite confusing.

I'm not sure what you are referring to.