mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
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/3168>
This commit is contained in:
parent
825746d121
commit
9dfb7b411e
2 changed files with 31 additions and 1 deletions
|
@ -154,6 +154,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,
|
||||
|
@ -671,6 +673,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)
|
||||
|
@ -811,6 +830,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));
|
||||
|
@ -823,6 +845,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;
|
||||
|
@ -1709,4 +1738,4 @@ gst_decklink_video_src_change_state (GstElement * element,
|
|||
out:
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -69,6 +69,7 @@ struct _GstDecklinkVideoSrc
|
|||
guint64 processed;
|
||||
guint64 dropped;
|
||||
guint64 first_stream_time;
|
||||
guint64 no_signal_count;
|
||||
|
||||
GstVideoInfo info;
|
||||
GstDecklinkVideoFormat video_format;
|
||||
|
|
Loading…
Reference in a new issue