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 654844 - dtsdec: stream with jitter sounds broken
dtsdec: stream with jitter sounds broken
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-07-18 12:11 UTC by Andreas Frisch
Modified: 2012-02-18 20:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch v1 (2.10 KB, patch)
2011-07-19 15:34 UTC, Oleksij Rempel
needs-work Details | Review

Description Andreas Frisch 2011-07-18 12:11:44 UTC
sample file is here:
http://www.uploadarea.de/files/vwv2saj3dbui7n31xncrez5o1.rar
password dts

gst-launch filesrc location=sample.mkv ! matroskademux ! audio/x-dts ! dcaparse ! dtsdec ! audioconvert ! alsasink

the playback has very short interruptions caused to messed up frame order in the stream

is there a way to re-order the dts frames somehow?
supposedly, there are quite some files out in the wild which have this problem
Comment 1 Tim-Philipp Müller 2011-07-18 12:39:31 UTC
Where do you see non-monotonically increasing timestamps?

I can reproduce the issue with the German track (audio_00), but it looks like it's just that there's too much jitter. It works fine for me with pulsesink drift-tolerance=80000
Comment 2 Oleksij Rempel 2011-07-18 15:25:44 UTC
DTS seems to be really restricted format. There is no variable bitrate or variable blocksize. I assume there should be no GAPs between frames.
It is defined that each block has 256 samples and it seems like muxing app or encoder  calculated wrong time, since the time difference is equal to 255 samples per block.

IMHO. On one sight i assume the encoder or muxer war brocken (this file was created 2008)

On other side, with all restrictions DTS has, there is no sense to use timestamps from container.

I just disabled this part of the code and it played this stream without any GAP and clicks:

diff --git a/ext/dts/gstdtsdec.c b/ext/dts/gstdtsdec.c
index 2039c58..0bbe632 100644
--- a/ext/dts/gstdtsdec.c
+++ b/ext/dts/gstdtsdec.c
@@ -800,13 +800,13 @@ gst_dtsdec_chain_raw (GstPad * pad, GstBuffer * buf)
   }
 
   /* merge with cache, if any. Also make sure timestamps match */
-  if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
+/*  if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
     dts->time = GST_BUFFER_TIMESTAMP (buf);
     GST_DEBUG_OBJECT (dts,
         "Received buffer with ts %" GST_TIME_FORMAT " duration %"
         GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
         GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
-  }
+  } */
 
   if (dts->cache) {
     buf = gst_buffer_join (dts->cache, buf);
Comment 3 Oleksij Rempel 2011-07-18 15:27:41 UTC
but i think this patch will brake things after seek.
Comment 4 Oleksij Rempel 2011-07-19 15:34:55 UTC
Created attachment 192249 [details] [review]
patch v1

Patch to make dtsdec more robust against brocken timestamps.
Comment 5 Tobias Mueller 2011-11-02 08:58:11 UTC
Could anybody review the patch?
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2011-11-28 11:01:44 UTC
Review of attachment 192249 [details] [review]:

::: ext/dts/gstdtsdec.c
@@ +810,3 @@
         GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
+
+    /* There are two possible bugs: time from container can be bigger als,

s/als/as/

@@ +811,3 @@
+
+    /* There are two possible bugs: time from container can be bigger als,
+     * real time of stream, so there is silent; or less, then it is an

s/so so there is silent/so that there is silence/

@@ +813,3 @@
+     * real time of stream, so there is silent; or less, then it is an
+     * overlap */
+    /* time overlap - contaniers timestamp is defenetly  brocken.

s/contaniers/containers/
s/defenetly/definitively/
s/brocken/broken/

@@ +814,3 @@
+     * overlap */
+    /* time overlap - contaniers timestamp is defenetly  brocken.
+     * Ignor it as long as possible,

s/Ignor/Ignore/

@@ +816,3 @@
+     * Ignor it as long as possible,
+     * for example: 4096 samples = 16 * 256 dts blocks */
+    if (container_ts + sample_time * 4096 < dts->time) {

It would be nice to have a simple define somewhere for the tolerance. Could be in audio.h / video.h. Do we need different values for audio/video?
Anyway I think this should be in time and not in samples.

@@ +818,3 @@
+    if (container_ts + sample_time * 4096 < dts->time) {
+      GST_DEBUG_OBJECT (dts, "overlaping samples: %lli",
+    /* time overlap - contaniers timestamp is defenetly  brocken.

please use the GLIB macros "samples %"G_GINT64_TIME_FORMAT, GST_CLOCK_DIFF(...)

@@ +824,3 @@
+      /* we can tollerate small GAPs */
+      GST_DEBUG_OBJECT (dts, "GAP samples: %lli",
+    if (container_ts + sample_time * 4096 < dts->time) {

here too.
Comment 7 Mark Nauwelaerts 2011-11-28 11:12:52 UTC
Oops (sort of); dtsdec was just recently ported to GstAudioDecoder, which renders this patch and kind of tricks mute (as it then comes with its own standard jitter/tolerance handling and property).

In particular, setting the tolerance properly (on the decoder, similar to pulsesink as indicated above) should then work out (though unable to test as link seems no longer accessible).
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2011-11-28 11:27:54 UTC
Okay, Andreas, please retest and close bug if it works now.
Comment 9 Andreas Frisch 2011-11-29 08:27:53 UTC
sorry i don't have that particular file anymore :(
Comment 10 Tim-Philipp Müller 2011-11-29 09:39:33 UTC
I've just re-tested it and it sounds fine now.