From 909fedd16817b534abca1c45a739426fd2d24559 Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Mon, 13 Jun 2011 23:43:55 -0700 Subject: [PATCH] Fix waiting for frame in decklink producer. --- src/modules/decklink/producer_decklink.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp index 8f041127..a0df7f33 100644 --- a/src/modules/decklink/producer_decklink.cpp +++ b/src/modules/decklink/producer_decklink.cpp @@ -229,9 +229,10 @@ public: { // Wait up to twice frame duration gettimeofday( &now, NULL ); - tm.tv_sec = now.tv_sec; - now.tv_usec += 2000000 / fps; - tm.tv_nsec = now.tv_usec * 1000; + long usec = now.tv_sec * 1000000 + now.tv_usec; + usec += 2000000 / fps; + tm.tv_sec = usec / 1000000; + tm.tv_nsec = (usec % 1000000) * 1000; if ( pthread_cond_timedwait( &m_condition, &m_mutex, &tm ) ) // Stop waiting if error (timed out) break; -- 2.39.2