mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
avwait: Don't reset time tracking when receiving the same segment again
This causes avwait to go back into "dropping" mode until audio and video are synced again, which is unnecessary when the segment didn't actually change. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2121>
This commit is contained in:
parent
791f1da7b8
commit
5bcfb2dda0
1 changed files with 29 additions and 13 deletions
|
@ -616,26 +616,32 @@ gst_avwait_vsink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEGMENT:{
|
||||
const GstSegment *segment;
|
||||
gboolean send_message = FALSE;
|
||||
gboolean segment_changed;
|
||||
|
||||
g_mutex_lock (&self->mutex);
|
||||
gst_event_copy_segment (event, &self->vsegment);
|
||||
gst_event_parse_segment (event, &segment);
|
||||
segment_changed = !gst_segment_is_equal (segment, &self->vsegment);
|
||||
self->vsegment = *segment;
|
||||
if (self->vsegment.format != GST_FORMAT_TIME) {
|
||||
GST_ERROR_OBJECT (self, "Invalid segment format");
|
||||
g_mutex_unlock (&self->mutex);
|
||||
gst_event_unref (event);
|
||||
return FALSE;
|
||||
}
|
||||
GST_DEBUG_OBJECT (self, "First time reset in video segment");
|
||||
self->running_time_to_wait_for = GST_CLOCK_TIME_NONE;
|
||||
self->running_time_to_end_at = GST_CLOCK_TIME_NONE;
|
||||
self->audio_running_time_to_wait_for = GST_CLOCK_TIME_NONE;
|
||||
self->audio_running_time_to_end_at = GST_CLOCK_TIME_NONE;
|
||||
if (!self->dropping) {
|
||||
self->dropping = TRUE;
|
||||
send_message = TRUE;
|
||||
if (segment_changed) {
|
||||
GST_DEBUG_OBJECT (self, "First time reset in video segment");
|
||||
self->running_time_to_wait_for = GST_CLOCK_TIME_NONE;
|
||||
self->running_time_to_end_at = GST_CLOCK_TIME_NONE;
|
||||
self->audio_running_time_to_wait_for = GST_CLOCK_TIME_NONE;
|
||||
self->audio_running_time_to_end_at = GST_CLOCK_TIME_NONE;
|
||||
if (!self->dropping) {
|
||||
self->dropping = TRUE;
|
||||
send_message = TRUE;
|
||||
}
|
||||
self->vsegment.position = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
self->vsegment.position = GST_CLOCK_TIME_NONE;
|
||||
g_mutex_unlock (&self->mutex);
|
||||
|
||||
if (send_message)
|
||||
|
@ -750,18 +756,28 @@ gst_avwait_asink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event));
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEGMENT:
|
||||
case GST_EVENT_SEGMENT:{
|
||||
const GstSegment *segment;
|
||||
gboolean segment_changed;
|
||||
|
||||
g_mutex_lock (&self->mutex);
|
||||
gst_event_copy_segment (event, &self->asegment);
|
||||
gst_event_parse_segment (event, &segment);
|
||||
segment_changed = !gst_segment_is_equal (segment, &self->asegment);
|
||||
self->asegment = *segment;
|
||||
|
||||
if (self->asegment.format != GST_FORMAT_TIME) {
|
||||
GST_ERROR_OBJECT (self, "Invalid segment format");
|
||||
g_mutex_unlock (&self->mutex);
|
||||
gst_event_unref (event);
|
||||
return FALSE;
|
||||
}
|
||||
self->asegment.position = GST_CLOCK_TIME_NONE;
|
||||
|
||||
if (segment_changed) {
|
||||
self->asegment.position = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
g_mutex_unlock (&self->mutex);
|
||||
break;
|
||||
}
|
||||
case GST_EVENT_FLUSH_START:
|
||||
g_mutex_lock (&self->mutex);
|
||||
self->audio_flush_flag = TRUE;
|
||||
|
|
Loading…
Reference in a new issue