]> git.sesse.net Git - nageru/commitdiff
Add some asserts that will trigger if a driver gives very bogus fps values.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 11 Jul 2016 18:23:56 +0000 (20:23 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 11 Jul 2016 18:24:00 +0000 (20:24 +0200)
mixer.cpp
resampling_queue.cpp

index 1934ee9429bcae271b3c6d22a9df64e2820a49fc..b76b6745ed2cc61a1f1d2e05358f682c70acc4d8 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -361,6 +361,7 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
        }
 
        int64_t frame_length = int64_t(TIMEBASE) * video_format.frame_rate_den / video_format.frame_rate_nom;
+       assert(frame_length > 0);
 
        size_t num_samples = (audio_frame.len > audio_offset) ? (audio_frame.len - audio_offset) / audio_format.num_channels / (audio_format.bits_per_sample / 8) : 0;
        if (num_samples > OUTPUT_FREQUENCY / 10) {
index 62c4413792b2cdba4be07119d692173dc0fb7b7f..c1945d27ab2a2f304edf7292d34334e00d8416e2 100644 (file)
@@ -63,6 +63,7 @@ void ResamplingQueue::add_input_samples(double pts, const float *samples, ssize_
 
 bool ResamplingQueue::get_output_samples(double pts, float *samples, ssize_t num_samples)
 {
+       assert(num_samples > 0);
        if (first_input) {
                // No data yet, just return zeros.
                memset(samples, 0, num_samples * 2 * sizeof(float));