mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
ajasrc: Drop some frames after signal recovery
After signal recovery the capture times for the next frames are simply wrong. Experimentally this affected 2-3 frames and seemed to be related to the buffer fill level after signal recovery, so drop at least 5 frames and up to fill level + 1 frames in this situation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7106>
This commit is contained in:
parent
63dec7c704
commit
f8fb72b0d7
1 changed files with 17 additions and 0 deletions
|
@ -2322,6 +2322,7 @@ static void capture_thread_func(AJAThread *thread, void *data) {
|
||||||
bool reset_clock = false;
|
bool reset_clock = false;
|
||||||
GstClockTime first_frame_time = 0;
|
GstClockTime first_frame_time = 0;
|
||||||
guint64 first_frame_processed_plus_dropped_minus_buffered = 0;
|
guint64 first_frame_processed_plus_dropped_minus_buffered = 0;
|
||||||
|
guint frames_to_drop = 0;
|
||||||
|
|
||||||
g_mutex_lock(&self->queue_lock);
|
g_mutex_lock(&self->queue_lock);
|
||||||
restart:
|
restart:
|
||||||
|
@ -2611,6 +2612,12 @@ restart:
|
||||||
g_cond_signal(&self->queue_cond);
|
g_cond_signal(&self->queue_cond);
|
||||||
have_signal = TRUE;
|
have_signal = TRUE;
|
||||||
reset_clock = true;
|
reset_clock = true;
|
||||||
|
|
||||||
|
// Drop the next frames after signal recovery as the capture times
|
||||||
|
// are generally just wrong.
|
||||||
|
frames_to_drop = MAX(status.acBufferLevel + 1, 5);
|
||||||
|
GST_TRACE_OBJECT(self, "Dropping %u frames after signal recovery",
|
||||||
|
frames_to_drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
iterations_without_frame = 0;
|
iterations_without_frame = 0;
|
||||||
|
@ -2692,6 +2699,16 @@ restart:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frames_to_drop > 0) {
|
||||||
|
GST_TRACE_OBJECT(self, "Dropping frame");
|
||||||
|
frames_to_drop -= 1;
|
||||||
|
gst_clear_buffer(&anc_buffer2);
|
||||||
|
gst_clear_buffer(&anc_buffer);
|
||||||
|
gst_clear_buffer(&audio_buffer);
|
||||||
|
gst_clear_buffer(&video_buffer);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const AUTOCIRCULATE_TRANSFER_STATUS &transfer_status =
|
const AUTOCIRCULATE_TRANSFER_STATUS &transfer_status =
|
||||||
transfer.GetTransferStatus();
|
transfer.GetTransferStatus();
|
||||||
const FRAME_STAMP &frame_stamp = transfer_status.GetFrameStamp();
|
const FRAME_STAMP &frame_stamp = transfer_status.GetFrameStamp();
|
||||||
|
|
Loading…
Reference in a new issue