decklink disp.: implemented timeout

This commit is contained in:
Martin Pulec
2022-10-05 10:57:47 +02:00
parent b2aa48139c
commit f7cc336cac
2 changed files with 5 additions and 3 deletions

View File

@@ -44,6 +44,7 @@
#define IF_NOT_NULL_ELSE(val, default_val) ((val) ? (val) : (default_val))
#define UNDEF -1
#define IF_NOT_UNDEF_ELSE(val, default_val) ((val) != UNDEF ? (val) : (default_val))
#define DIV_ROUNDED_UP(value, div) ((((value) % (div)) != 0) ? ((value) / (div) + 1) : ((value) / (div)))
/**
* @brief Creates FourCC word

View File

@@ -576,7 +576,7 @@ static void update_timecode(DeckLinkTimecode *tc, double fps)
tc->SetBCD(bcd);
}
static int display_decklink_putf(void *state, struct video_frame *frame, long long flag)
static int display_decklink_putf(void *state, struct video_frame *frame, long long timeout_ns)
{
struct state_decklink *s = (struct state_decklink *)state;
@@ -587,8 +587,9 @@ static int display_decklink_putf(void *state, struct video_frame *frame, long lo
uint32_t i;
s->state.at(0).deckLinkOutput->GetBufferedVideoFrameCount(&i);
if ((flag == PUTF_NONBLOCK && i > 2) || flag == PUTF_DISCARD) {
if (flag == PUTF_NONBLOCK) {
long long max_frames = DIV_ROUNDED_UP(timeout_ns, (long long)(NS_IN_SEC / frame->fps));
if (timeout_ns == PUTF_DISCARD || i > max_frames) {
if (timeout_ns != PUTF_DISCARD) {
log_msg(LOG_LEVEL_WARNING, MOD_NAME "Frame dropped!\n");
}
for (int j = 0; j < s->devices_cnt; ++j) {