mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-09 05:38:58 +00:00
assrender: Consume text buffers if they're to be displayed in the next 500ms
Instead of only consuming them if they're to be display now. Consuming them then might make following buffers with the same timestamp to be too late.
This commit is contained in:
parent
bcdb7d4851
commit
659776f1b1
1 changed files with 7 additions and 7 deletions
|
@ -988,12 +988,7 @@ gst_ass_render_chain_video (GstPad * pad, GstBuffer * buffer)
|
||||||
gst_segment_to_running_time (&render->video_segment, GST_FORMAT_TIME,
|
gst_segment_to_running_time (&render->video_segment, GST_FORMAT_TIME,
|
||||||
GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer));
|
GST_BUFFER_TIMESTAMP (buffer) + GST_BUFFER_DURATION (buffer));
|
||||||
|
|
||||||
if (sub_running_time <= vid_running_time_end) {
|
if (sub_running_time_end < vid_running_time) {
|
||||||
gst_ass_render_process_text (render, render->subtitle_pending,
|
|
||||||
sub_running_time, sub_running_time_end - sub_running_time);
|
|
||||||
render->subtitle_pending = NULL;
|
|
||||||
g_cond_signal (render->subtitle_cond);
|
|
||||||
} else if (sub_running_time_end < vid_running_time) {
|
|
||||||
gst_buffer_unref (render->subtitle_pending);
|
gst_buffer_unref (render->subtitle_pending);
|
||||||
GST_DEBUG_OBJECT (render,
|
GST_DEBUG_OBJECT (render,
|
||||||
"Too late text buffer, dropping (%" GST_TIME_FORMAT " < %"
|
"Too late text buffer, dropping (%" GST_TIME_FORMAT " < %"
|
||||||
|
@ -1001,6 +996,11 @@ gst_ass_render_chain_video (GstPad * pad, GstBuffer * buffer)
|
||||||
GST_TIME_ARGS (vid_running_time));
|
GST_TIME_ARGS (vid_running_time));
|
||||||
render->subtitle_pending = NULL;
|
render->subtitle_pending = NULL;
|
||||||
g_cond_signal (render->subtitle_cond);
|
g_cond_signal (render->subtitle_cond);
|
||||||
|
} else if (sub_running_time <= vid_running_time_end + GST_SECOND / 2) {
|
||||||
|
gst_ass_render_process_text (render, render->subtitle_pending,
|
||||||
|
sub_running_time, sub_running_time_end - sub_running_time);
|
||||||
|
render->subtitle_pending = NULL;
|
||||||
|
g_cond_signal (render->subtitle_cond);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_mutex_unlock (render->subtitle_mutex);
|
g_mutex_unlock (render->subtitle_mutex);
|
||||||
|
@ -1100,7 +1100,7 @@ gst_ass_render_chain_text (GstPad * pad, GstBuffer * buffer)
|
||||||
vid_running_time +=
|
vid_running_time +=
|
||||||
gst_util_uint64_scale (GST_SECOND, render->fps_d, render->fps_n);
|
gst_util_uint64_scale (GST_SECOND, render->fps_d, render->fps_n);
|
||||||
|
|
||||||
if (sub_running_time > vid_running_time) {
|
if (sub_running_time > vid_running_time + GST_SECOND / 2) {
|
||||||
g_assert (render->subtitle_pending == NULL);
|
g_assert (render->subtitle_pending == NULL);
|
||||||
g_mutex_lock (render->subtitle_mutex);
|
g_mutex_lock (render->subtitle_mutex);
|
||||||
if (G_UNLIKELY (render->subtitle_flushing)) {
|
if (G_UNLIKELY (render->subtitle_flushing)) {
|
||||||
|
|
Loading…
Reference in a new issue