]> git.sesse.net Git - mlt/commitdiff
Fix waiting for frame in decklink producer.
authorDan Dennedy <dan@dennedy.org>
Tue, 14 Jun 2011 06:43:55 +0000 (23:43 -0700)
committerDan Dennedy <dan@dennedy.org>
Tue, 14 Jun 2011 06:43:55 +0000 (23:43 -0700)
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;