]> git.sesse.net Git - mlt/blobdiff - src/modules/decklink/producer_decklink.cpp
Fix waiting for frame in decklink producer.
[mlt] / src / modules / decklink / producer_decklink.cpp
index 8f0411276e5e32c3b4902315bc12a0284a13ec17..a0df7f335758d94e6eee98d0fb22d4de3adb4ad9 100644 (file)
@@ -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;