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 746822 - qtdemux: segment query reports wrong values after key-unit seek
qtdemux: segment query reports wrong values after key-unit seek
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other All
: Normal normal
: 1.5.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-26 15:55 UTC by Nicolas Dufresne (ndufresne)
Modified: 2015-04-22 17:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
qtdemux: Update segment.start after key-unit seek (696 bytes, patch)
2015-04-10 00:19 UTC, Hyunjun Ko
none Details | Review
qtdemux: Update segment.start after key-unit seek (747 bytes, patch)
2015-04-10 01:02 UTC, Hyunjun Ko
none Details | Review
qtdemux: Update segment.start after key-unit seek (749 bytes, patch)
2015-04-10 05:07 UTC, Hyunjun Ko
committed Details | Review

Description Nicolas Dufresne (ndufresne) 2015-03-26 15:55:24 UTC
This is a bit odd, and didn't yet investigate but I notice the stream duration is different after each seeks.
Comment 1 Hyunjun Ko 2015-04-10 00:13:55 UTC
When doing key uint seek, qtdemux calls gst_qtdemux_adjust_seek to get proper offset.
And then this offset is set to segment.position and segment.time in gst_qtdemux_perform_seek.

After that, app sends segment query,  qtdemux set start, stop to query. During this job, it gets new value from gst_segment_to_stream_time and sets them to query.

For example, app seeks 0:00:53.229000 and it aligns to 0:00:50.000 by 
keyframe seek. And then app gets result of the query that has start=0:00:50.000, stop=0:00:59.721.
app (rtsp-server) thinks of stop time as finish time. 
But real finish time is 0:01:02.95000 ( this gap is exactly same as 
one between start time and postion)

At this moment, qtdemux->segment is like below.
segment start=0:00:53.229000000,
offset=0:00:00.000000000,
stop=0:01:02.950000000,
rate=1.000000,
applied_rate=1.000000,
flags=0x01,
time=0:00:50.000000000,
base=0:00:00.000000000,
position 0:00:50.000000000,
duration 0:01:02.950000000

As talk with Thiago, it is a bug of qt demuxer.
Qt demuxer's segment.start is has to be updated after key-unit seek as like segment.time

I'm working on this.
Comment 2 Hyunjun Ko 2015-04-10 00:19:11 UTC
Created attachment 301244 [details] [review]
qtdemux: Update segment.start after key-unit seek
Comment 3 Hyunjun Ko 2015-04-10 00:59:38 UTC
Comment on attachment 301244 [details] [review]
qtdemux: Update segment.start after key-unit seek

>From a45462b941aea35fa9c909267255e26cb675a957 Mon Sep 17 00:00:00 2001
>From: Hyunjun <zzoon.ko@samsung.com>
>Date: Fri, 10 Apr 2015 09:17:26 +0900
>Subject: [PATCH] qtdemux: Update segment.start after key-unit seek
>
>https://bugzilla.gnome.org/show_bug.cgi?id=746822
>
>---
> gst/isomp4/qtdemux.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
>index 2279097..518f174 100644
>--- a/gst/isomp4/qtdemux.c
>+++ b/gst/isomp4/qtdemux.c
>@@ -1432,6 +1432,7 @@ gst_qtdemux_perform_seek (GstQTDemux * qtdemux, GstSegment * segment,
>   }
>   segment->position = desired_offset;
>   segment->time = desired_offset;
>+  segment->start = desired_offset;
> 
>   /* we stop at the end */
>   if (segment->stop == -1)
>-- 
>2.1.0
>
Comment 4 Hyunjun Ko 2015-04-10 01:01:05 UTC
Comment on attachment 301244 [details] [review]
qtdemux: Update segment.start after key-unit seek

>From a45462b941aea35fa9c909267255e26cb675a957 Mon Sep 17 00:00:00 2001
>From: Hyunjun <zzoon.ko@samsung.com>
>Date: Fri, 10 Apr 2015 09:17:26 +0900
>Subject: [PATCH] qtdemux: Update segment.start after key-unit seek
>
>https://bugzilla.gnome.org/show_bug.cgi?id=746822
>
>---
> gst/isomp4/qtdemux.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
>index 2279097..518f174 100644
>--- a/gst/isomp4/qtdemux.c
>+++ b/gst/isomp4/qtdemux.c
>@@ -1432,6 +1432,7 @@ gst_qtdemux_perform_seek (GstQTDemux * qtdemux, GstSegment * segment,
>   }
>   segment->position = desired_offset;
>   segment->time = desired_offset;
>+  segment->start = desired_offset;
> 
>   /* we stop at the end */
>   if (segment->stop == -1)
>-- 
>2.1.0
>
Comment 5 Hyunjun Ko 2015-04-10 01:02:37 UTC
Created attachment 301248 [details] [review]
qtdemux: Update segment.start after key-unit seek
Comment 6 Hyunjun Ko 2015-04-10 05:07:27 UTC
Created attachment 301253 [details] [review]
qtdemux: Update segment.start after key-unit seek
Comment 7 Thiago Sousa Santos 2015-04-10 13:33:42 UTC
Thanks for the patch, added a commit description and pushed.

commit 7fbd1b472fd016ed3293a360123b1dd55bee18e4
Author: Hyunjun Ko <zzoon.ko@samsung.com>
Date:   Fri Apr 10 09:17:26 2015 +0900

    qtdemux: Update segment.start after key-unit seek
    
    When doing key uint seek, qtdemux calls gst_qtdemux_adjust_seek
    to get proper offset. And then this offset is set to
    segment.position and segment.time in gst_qtdemux_perform_seek but
    segment.start is not updated.
    
    After that, application sends segment query,
    qtdemux sets start and stop to query using gst_segment_to_stream_time. Due
    to the wrong value in segment.start, the stop position is smaller than
    it should.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746822
Comment 8 Nicolas Dufresne (ndufresne) 2015-04-22 17:06:39 UTC
Neat, thanks for fixing that !