decklink: reset calculation of gst_decklink_video_src_update_time_mapping on no_signal. When the HDMI cable was disconnected for a long time, the calculation took too much time. SDI cable works fine.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3132>
This commit is contained in:
Wojciech Kapsa 2022-10-07 08:30:05 +02:00 committed by GStreamer Marge Bot
parent 2d838a9b3d
commit b618ff3369
2 changed files with 31 additions and 1 deletions

View file

@ -155,6 +155,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_decklink_video_src_debug);
#define ABSDIFF(x, y) ( (x) > (y) ? ((x) - (y)) : ((y) - (x)) )
#endif
#define NO_SIGNL_RESET_COUNT (10)
enum
{
PROP_0,
@ -697,6 +699,23 @@ gst_decklink_video_src_start (GstDecklinkVideoSrc * self)
return TRUE;
}
static void
gst_decklink_reset_time_mapping(GstDecklinkVideoSrc * self)
{
self->window_fill = 0;
self->window_filled = FALSE;
self->window_skip = 1;
self->window_skip_count = 0;
self->current_time_mapping.xbase = 0;
self->current_time_mapping.b = 0;
self->current_time_mapping.num = 1;
self->current_time_mapping.den = 1;
self->next_time_mapping.xbase = 0;
self->next_time_mapping.b = 0;
self->next_time_mapping.num = 1;
self->next_time_mapping.den = 1;
}
static void
gst_decklink_video_src_update_time_mapping (GstDecklinkVideoSrc * self,
GstClockTime capture_time, GstClockTime stream_time)
@ -837,6 +856,9 @@ gst_decklink_video_src_got_frame (GstElement * element,
return;
}
if (no_signal)
self->no_signal_count++;
if (self->drop_no_signal_frames && no_signal) {
CaptureFrame f;
memset (&f, 0, sizeof (f));
@ -849,6 +871,13 @@ gst_decklink_video_src_got_frame (GstElement * element,
return;
}
if (!no_signal) {
if (self->no_signal_count > NO_SIGNL_RESET_COUNT) {
gst_decklink_reset_time_mapping(self);
}
self->no_signal_count = 0;
}
gst_decklink_video_src_update_time_mapping (self, capture_time, stream_time);
if (self->output_stream_time) {
timestamp = stream_time;

View file

@ -70,6 +70,7 @@ struct _GstDecklinkVideoSrc
guint64 processed;
guint64 dropped;
guint64 first_stream_time;
guint64 no_signal_count;
GstVideoInfo info;
GstDecklinkVideoFormat video_format;