]> git.sesse.net Git - bmusb/commitdiff
Fix wraparound in some timecode comparisons.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 13 Oct 2015 23:05:06 +0000 (01:05 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 13 Oct 2015 23:05:06 +0000 (01:05 +0200)
bmusb.cpp

index 8b40f4997306cef972b0fd03b46c402bc6c30508..387e042900ea82bc10d3f7775e1915c7f8113c1e 100644 (file)
--- a/bmusb.cpp
+++ b/bmusb.cpp
@@ -158,12 +158,12 @@ void BMUSBCapture::dequeue_thread_func()
 
                uint16_t video_timecode = pending_video_frames.front().timecode;
                uint16_t audio_timecode = pending_audio_frames.front().timecode;
-               if (video_timecode < audio_timecode) {
+               if (uint16_less_than_with_wraparound(video_timecode, audio_timecode)) {
                        printf("Video block 0x%04x without corresponding audio block, dropping.\n",
                                video_timecode);
                        video_frame_allocator->release_frame(pending_video_frames.front().frame);
                        pending_video_frames.pop_front();
-               } else if (audio_timecode < video_timecode) {
+               } else if (uint16_less_than_with_wraparound(audio_timecode, video_timecode)) {
                        printf("Audio block 0x%04x without corresponding video block, sending blank frame.\n",
                                audio_timecode);
                        QueuedFrame audio_frame = pending_audio_frames.front();