]> git.sesse.net Git - nageru/commitdiff
Fix an integer overflow with very long master frames.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 11 May 2020 18:14:47 +0000 (20:14 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 11 May 2020 18:14:47 +0000 (20:14 +0200)
nageru/mixer.cpp

index 915ae0eb7b9bb988cd5de06fa50ed4f951c5726d..212041bd1b0f5c69ecab7e6116e5e1844015ad8e 100644 (file)
@@ -1366,7 +1366,7 @@ start:
 
        // This might get off by a fractional sample when changing master card
        // between ones with different frame rates, but that's fine.
-       int num_samples_times_timebase = OUTPUT_FREQUENCY * output_frame_info.frame_duration + fractional_samples;
+       int64_t num_samples_times_timebase = int64_t(OUTPUT_FREQUENCY) * output_frame_info.frame_duration + fractional_samples;
        output_frame_info.num_samples = num_samples_times_timebase / TIMEBASE;
        fractional_samples = num_samples_times_timebase % TIMEBASE;
        assert(output_frame_info.num_samples >= 0);