mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 21:06:17 +00:00
assrender: fix seeking backwards
Use proper API to flush libass events when we do a flushing seek, and also do it in FLUSH_STOP rather than FLUSH_START, so we can be sure streaming has stopped. Fixes seeking back in time. Something seems to have changed in libass that renders the old manual way of flushing events ineffective and libass then seems to ignore timestamps that are older than the ones last seen then if we do it the old way. Fixes #916
This commit is contained in:
parent
e52f33430d
commit
ab12a4cd0f
1 changed files with 5 additions and 12 deletions
|
@ -1741,7 +1741,6 @@ gst_ass_render_query_video (GstPad * pad, GstObject * parent, GstQuery * query)
|
|||
static gboolean
|
||||
gst_ass_render_event_text (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||
{
|
||||
gint i;
|
||||
gboolean ret = FALSE;
|
||||
GstAssRender *render = GST_ASS_RENDER (parent);
|
||||
|
||||
|
@ -1812,6 +1811,11 @@ gst_ass_render_event_text (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
break;
|
||||
}
|
||||
case GST_EVENT_FLUSH_STOP:
|
||||
g_mutex_lock (&render->ass_mutex);
|
||||
if (render->ass_track) {
|
||||
ass_flush_events (render->ass_track);
|
||||
}
|
||||
g_mutex_unlock (&render->ass_mutex);
|
||||
GST_ASS_RENDER_LOCK (render);
|
||||
GST_INFO_OBJECT (render, "text flush stop");
|
||||
render->subtitle_flushing = FALSE;
|
||||
|
@ -1824,17 +1828,6 @@ gst_ass_render_event_text (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
break;
|
||||
case GST_EVENT_FLUSH_START:
|
||||
GST_DEBUG_OBJECT (render, "text flush start");
|
||||
g_mutex_lock (&render->ass_mutex);
|
||||
if (render->ass_track) {
|
||||
/* delete any events on the ass_track */
|
||||
for (i = 0; i < render->ass_track->n_events; i++) {
|
||||
GST_DEBUG_OBJECT (render, "deleted event with eid %i", i);
|
||||
ass_free_event (render->ass_track, i);
|
||||
}
|
||||
render->ass_track->n_events = 0;
|
||||
GST_DEBUG_OBJECT (render, "done flushing");
|
||||
}
|
||||
g_mutex_unlock (&render->ass_mutex);
|
||||
GST_ASS_RENDER_LOCK (render);
|
||||
render->subtitle_flushing = TRUE;
|
||||
GST_ASS_RENDER_BROADCAST (render);
|
||||
|
|
Loading…
Reference in a new issue