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 723075 - matroskademux: invalid handling of flushing seek without start position
matroskademux: invalid handling of flushing seek without start position
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
unspecified
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-27 08:53 UTC by Patricia Muscalu
Modified: 2015-03-25 22:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
flushing seek without start position (1.24 KB, patch)
2014-01-27 08:53 UTC, Patricia Muscalu
needs-work Details | Review

Description Patricia Muscalu 2014-01-27 08:53:43 UTC
Created attachment 267276 [details] [review]
flushing seek without start position

In case of the flushing seek and the undefined start position, the playback does not continue at the current position as it should but goes back in time.
Comment 1 Sebastian Dröge (slomo) 2014-01-29 20:22:47 UTC
Review of attachment 267276 [details] [review]:

::: gst/matroska/matroska-demux.c
@@ +2188,2 @@
 finish:
+  if (keyunit && (cur_type != GST_SEEK_TYPE_NONE)) {

I think this part is not correct, if the keyunit flag is set we should move to a keyunit.

@@ +2227,2 @@
   /* update some (segment) state */
+  if (cur_type != GST_SEEK_TYPE_NONE)

Also here
Comment 2 Patricia Muscalu 2014-01-30 07:45:43 UTC
Shouldn't the key unit be ignored in case of an undefined position?
Comment 3 Patricia Muscalu 2014-01-30 10:28:19 UTC
If cur_type is set to _TYPE_NONE we should not move current position regardless of the value of the keyunit flag or have we misunderstood something?
Comment 4 Sebastian Dröge (slomo) 2014-01-30 19:17:40 UTC
I'm not sure, the docs don't really define that. But I would expect it to go to the nearest keyframe. If you don't want that you would not set the flag :)
Comment 5 Patricia Muscalu 2014-01-31 08:25:48 UTC
According to GStreamer 1.0 Core Reference Manual:

gst_event_new_seek()
"...
A type of GST_SEEK_TYPE_NONE means that the position should not be updated.
..."

Are we missing something here?
Comment 6 Sebastian Dröge (slomo) 2014-01-31 13:27:40 UTC
See docs/design/part-seeking.txt:

2. GST_SEEK_FLAG_KEY_UNIT:

If the KEY_UNIT flag is specified, the demuxer/parser should adjust the
segment start to the position of the key frame closest to the requested
seek position and then start pushing out data from there. The nearest
key frame may be before or after the requested seek position, but many
implementations will only look for the closest keyframe before the
requested position.




There's some ambiguity here. SEEK_TYPE_NONE says "do not update position", however KEY_UNIT says "position should be adjusted to closest key unit". It's not clear to me which of the two would take preference here, but I think it is more powerful if in this case the demuxer would go to the nearest keyframe according to the current position. If you don't want that you would not set the KEY_UNIT flag on the seek, and then it wouldn't go to the nearest keyframe for the current position but instead stay exactly at the current position.

Does that make sense to you?
Comment 7 Nicolas Dufresne (ndufresne) 2014-01-31 13:42:29 UTC
I would not be surprise though if by accident, when the flush flag is present, the demuxer endup stepping to the next frame. Also, I would be surprise if all demuxer take the time to operate a seek to effectively find the closest (rather then the closest coming after). Something we can improve of course.
Comment 8 Sebastian Dröge (slomo) 2014-01-31 13:51:03 UTC
You're talking about implementation :) I'm sure many are not behaving correctly...


But first of all we should try to understand what the expected and intended behaviour according to the API is. I think we should consider the flags even if the seek type is NONE (especially FLUSH flag of course). And well, the KEY_UNIT flag only says to a close key unit, so could be before or after. You can define if it should be before or after by using the two SNAP flags (which of course also first need to be implemented properly in the demuxer).
Comment 9 Patricia Muscalu 2014-02-04 11:10:32 UTC
I understand your point of view. However, the documentation should be more clear about what seek flags are prioritized , the combination of the flags etc.

I'll try to solve the problem in gst-rtsp-server and make sure that KEY_INIT flag is not set while seek with SEEK_TYPE_NONE is about to be performed.

Thank you!
Comment 10 Wim Taymans 2014-02-06 09:37:46 UTC
commit 450b9d0a14fa8e727c339c02e0b09a2a5969b4c7
Author: Wim Taymans <wtaymans@redhat.com>
Date:   Thu Feb 6 09:48:05 2014 +0100

    media: only set keyframe flag when modifying start
    
    Only set the keyframe flag when we modify the start position. The
    keyframe flag should probably be ignored when no change is requested but
    until we can claim this is all documented properly and all demuxer
    implement this, avoid setting the flag.
    
    See also https://bugzilla.gnome.org/show_bug.cgi?id=723075
Comment 11 Sebastian Dröge (slomo) 2014-02-06 20:29:07 UTC
Wim, can we close this then and everything's correct in matroskademux?
Comment 12 Nicolas Dufresne (ndufresne) 2015-03-25 22:30:08 UTC
Seems to work, please reopen if there is any new issue around this.