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 765662 - adapter: invalid returned distance when getting prev pts/dts at offset
adapter: invalid returned distance when getting prev pts/dts at offset
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 1.10.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-04-27 09:02 UTC by Nicolas Huet
Modified: 2016-11-12 08:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch fixing the issue (2.38 KB, patch)
2016-04-27 09:02 UTC, Nicolas Huet
committed Details | Review
unit tests (3.66 KB, patch)
2016-04-27 12:17 UTC, Nicolas Huet
needs-work Details | Review
small test program (1.20 KB, text/plain)
2016-04-27 12:18 UTC, Nicolas Huet
  Details
patch for adapter unit tests (5.07 KB, patch)
2016-05-09 13:41 UTC, Nicolas Huet
committed Details | Review

Description Nicolas Huet 2016-04-27 09:02:44 UTC
Created attachment 326844 [details] [review]
patch fixing the issue

The function gst_adapter_prev_pts_at_offset and gst_adapter_prev_dts_at_offset does not return the correct distance.

It always returns the distance without taking care of the pts/dts offset found which does not seems correct regarding the description.

I have attach a patch that fix the issue.
Comment 1 Tim-Philipp Müller 2016-04-27 09:12:31 UTC
Any chance you could add a short unit test for this too? :)
Comment 2 Nicolas Huet 2016-04-27 09:14:00 UTC
I will try to make a quick one :)
Comment 3 Nicolas Huet 2016-04-27 12:17:39 UTC
Created attachment 326864 [details] [review]
unit tests
Comment 4 Nicolas Huet 2016-04-27 12:18:06 UTC
Created attachment 326865 [details]
small test program
Comment 5 Nicolas Huet 2016-04-27 12:18:56 UTC
Running the small test executable I have the following results:
Without the fix:
** Message: offset 0 PTS=0:00:00.000000000 distance=0
** Message: offset 2048 PTS=0:00:00.000000000 distance=2048
** Message: offset 4096 PTS=0:00:00.023219955 distance=4096
** Message: offset 6144 PTS=0:00:00.046439910 distance=6144
** Message: offset 8192 PTS=0:00:00.069659865 distance=8192
** Message: offset 10240 PTS=0:00:00.092879820 distance=10240
** Message: offset 12288 PTS=0:00:00.116099775 distance=12288
** Message: offset 14336 PTS=0:00:00.139319730 distance=14336
** Message: offset 16384 PTS=0:00:00.162539685 distance=16384
** Message: offset 18432 PTS=0:00:00.185759640 distance=18432

With the fix:
** Message: offset 0 PTS=0:00:00.000000000 distance=0
** Message: offset 2048 PTS=0:00:00.000000000 distance=2048
** Message: offset 4096 PTS=0:00:00.023219955 distance=2048
** Message: offset 6144 PTS=0:00:00.046439910 distance=2048
** Message: offset 8192 PTS=0:00:00.069659865 distance=2048
** Message: offset 10240 PTS=0:00:00.092879820 distance=2048
** Message: offset 12288 PTS=0:00:00.116099775 distance=2048
** Message: offset 14336 PTS=0:00:00.139319730 distance=2048
** Message: offset 16384 PTS=0:00:00.162539685 distance=2048
** Message: offset 18432 PTS=0:00:00.185759640 distance=2048
Comment 6 Sebastian Dröge (slomo) 2016-05-02 08:45:28 UTC
Comment on attachment 326864 [details] [review]
unit tests

Can you make the unit tests a patch against gstreamer/tests/check/libs/gstadapter.c?
Comment 7 Nicolas Huet 2016-05-09 13:41:45 UTC
Created attachment 327518 [details] [review]
patch for adapter unit tests
Comment 8 Tim-Philipp Müller 2016-11-11 18:24:56 UTC
Thanks, pushed with minor changes (adapter: fix conflicts, test: use fail_unless_equals_int):

commit 9ae9a01fe2d454b954bd53918b53103c3972db02
Author: Nicolas Huet <nicolas.huet@parrot.com>
Date:   Mon May 9 15:32:43 2016 +0200

    tests: add unit test for gst_adapter_prev_pts_at_offset()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765662

commit 9cd2677791bc25c9ad1885c86b40ac0b3328dd31
Author: Nicolas Huet <nicolas.huet@parrot.com>
Date:   Wed Apr 27 10:57:29 2016 +0200

    adapter: fix distance when getting prev pts/dts at offset
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765662