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 739990 - basesink: set the last position to minimum value after rewind
basesink: set the last position to minimum value after rewind
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-11-12 01:31 UTC by Myoungsun Lee
Modified: 2018-11-03 12:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Set the last position to minimum value after rewind (3.35 KB, patch)
2014-11-12 01:31 UTC, Myoungsun Lee
none Details | Review
basesink set the last position to minimum value (1.05 KB, patch)
2014-11-14 00:40 UTC, Myoungsun Lee
none Details | Review
compare basesink timestamp log (65.87 KB, application/zip)
2015-05-28 06:01 UTC, Myoungsun Lee
  Details

Description Myoungsun Lee 2014-11-12 01:31:59 UTC
Created attachment 290452 [details] [review]
Set the last position to minimum value after rewind

Set the last position to minimum value after rewind

Overview:
Let's suppose the video file is encoded with wrong pts value
If we rewind this file and wait until the video play again at first,
then the basesink sets the last position to wrong value.
So in this case, basesink chooses the minimum value to set the last position.

Steps to Reproduce:
rewind the video and wait until it play again at start position.

Actual Results:
the play(current) time temporarily increases to the wrong position.
and play again at start.

Expected Results:
play well without increasing the play time to the wrong position.
Comment 1 Myoungsun Lee 2014-11-14 00:40:54 UTC
Created attachment 290674 [details] [review]
basesink set the last position to minimum value
Comment 2 Sebastian Dröge (slomo) 2015-03-23 09:21:44 UTC
Can you provide a unit test or other kind of easily reproducible testcase for this, or explain in more detail what exactly goes wrong here when and why?
Comment 3 Myoungsun Lee 2015-03-24 01:09:52 UTC
There are some files which the un-sequential PTS stored in the index table.
It means that the PTS did not increase or decrease sequentially, so the PTS can suddenly increase or decrease in the middle of playing.

I use embedded systems in special platform so I cannot provide the unit test. 
Anyway, I can see the progress bar in my test environment. 

Test case: Rewind these files and wait until the play time goes to the begining(usually 0 sec).
Problem: The progress bar suddenly goes to random position. 
Expected Result: If the rewind finished at the begining of file, then the normal playback start and the position increase sequentially.

Root cause: When the playback position reach the beginig of file, the pipeline status changed PLAYING to PAUSED for restarting the file.
Then the pipeline get the wrong last position in PAUSED status. - The last position is the base position when the file restart after some playback event(Fast forward or rewind).
Comment 4 Sebastian Dröge (slomo) 2015-03-24 16:16:56 UTC
If there's DTS on the buffers, the DTS is used in the sink. In which case the DTS must monotonically increase (rate > 0) or decrease (rate < 0). Everything else would be a bug in upstream elements.

If there's no DTS on buffers, the PTS is used in the sink. In which case the PTS must monotonically increase or decrease... etc :)

So it seems like something is producing wrong values in your pipeline.


Nonetheless basesink should compensate for that somehow, but I think it should already do that in the beginning of it's chain function.
Comment 5 Myoungsun Lee 2015-03-26 05:20:07 UTC
As you said, normal files must monotonically increase or decrease their DTS/PTS value. But there are abnormal files - not increase or decrease monotonically - so the problem occurs in this case.

The files I tested are index files, container is asf, wmv, mp4 files.

I'm sure if there is no progress bar, then it's not a problem.
But if we can see the progress bar by player program, then the bar is abnormally jumped to some point.


I think the person who use the gstreamer in linux, or some OS by command line don't need this patch, but the person who make a player program by using gstreamer need this patch.
Comment 6 Sebastian Dröge (slomo) 2015-03-26 08:50:58 UTC
(In reply to Myoungsun Lee from comment #5)
> As you said, normal files must monotonically increase or decrease their
> DTS/PTS value. But there are abnormal files - not increase or decrease
> monotonically - so the problem occurs in this case.
> 
> The files I tested are index files, container is asf, wmv, mp4 files.

I'm not talking about files here, but that the audio/video decoders at latest should fix up such broken PTS/DTS.

> I'm sure if there is no progress bar, then it's not a problem.
> But if we can see the progress bar by player program, then the bar is
> abnormally jumped to some point.
> 
> I think the person who use the gstreamer in linux, or some OS by command
> line don't need this patch, but the person who make a player program by
> using gstreamer need this patch.

I still think that this patch is doing things too late. The fixup for broken PTS/DTS shouldn't be in the position reporting, but earlier in the chain function already.

It would be good if you could provide a testcase and sample file, or at least a very detailed list of things that are happening inside basesink to lead to this situation (e.g. a debug log with basesink:6 would be a good start, with some explanations what times are seen when and what would be expected instead).
Comment 7 Myoungsun Lee 2015-05-28 06:01:12 UTC
Created attachment 304123 [details]
compare basesink timestamp log

I attached the log file about basesink:6 level.

[Summary]
I pushed REWIND command and wait until the video reached start point(0 sec).
Then I can see the progress bar pop-up to any time position, not 0 sec.
Because the last time is set "stop" value in gst_base_sink_get_position(), the progress bar is abnormal.

-before
basesink gstbasesink.c:4627:default_element_query:<videosink> position query in format time
basesink gstbasesink.c:4416:gst_base_sink_get_position:<videosink> using clock and base time 0:37:31.851788888
basesink gstbasesink.c:4443:gst_base_sink_get_position:<videosink> in PAUSED using last 0:00:05.000000000
basesink gstbasesink.c:4477:gst_base_sink_get_position:<videosink> using last seen timestamp 0:00:05.000000000
basesink gstbasesink.c:4549:gst_base_sink_get_position:<videosink> res: 1, POSITION: 0:00:05.000000000
basesink gstbasesink.c:4746:default_element_query:<videosink> query position returns 1
======> The progress bar is set by the last time value. It is set "5" sec, so the progress bar is pop-up this position. It need to start from "0" sec.



-after patch
basesink gstbasesink.c:4627:default_element_query:<videosink> position query in format time
basesink gstbasesink.c:4416:gst_base_sink_get_position:<videosink> using clock and base time 0:46:34.971955555
basesink gstbasesink.c:4443:gst_base_sink_get_position:<videosink> in PAUSED using last 0:00:00.000000000
basesink gstbasesink.c:4477:gst_base_sink_get_position:<videosink> using last seen timestamp 0:00:00.000000000
basesink gstbasesink.c:4549:gst_base_sink_get_position:<videosink> res: 1, POSITION: 0:00:00.000000000
basesink gstbasesink.c:4746:default_element_query:<videosink> query position returns 1
===> Then the last position is set the smallest time value. In REWIND case, the last time has to mean the smallest one that the basesink remembered.(In FORWARD case, it means the largest one.)
Comment 8 Vivia Nikolaidou 2018-05-06 10:57:59 UTC
Required information has been provided. Setting back to NEW.
Comment 9 GStreamer system administrator 2018-11-03 12:24:01 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/79.