GNOME Bugzilla – Bug 696613
matroskademux: problem with seeking precision in some files
Last modified: 2018-05-12 08:14:16 UTC
If I play .mkv files in my app, then seeking to a position is not performed correctly. I have an filesrc, decodbin and an appsink. If I call gst_element_seek(GST_ELEMENT(m_pipeline), 1.0, GST_FORMAT_DEFAULT, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, qMin(i_stamp, m_duration), GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); gst_element_query_position(GST_ELEMENT(m_pipeline), GST_FORMAT_DEFAULT, &stamp); then stamp contains same value as i_stamp, the stamp I want to set. It does not matter if I use stamp or frame mode (GST_FORMAT_DEFAULT or GST_FORMAT_TIME) behaviour is same in both modes. The problem is that the next buffer I get in my appsink has a stamp which is about 2-3 frames behind the frame or stamp I set. The problem occurs only in some .mkv files.
the download link: https://rapidshare.com/files/3623430509/heute%20nacht%20-%20MPEG-1%20mp2.mkv
You should use GST_SEEK_FLAG_ACCURATE in addition to the flush flag to go to *exactly* where you requested.