diff options
author | Nikolay Borodin <[email protected]> | 2023-12-29 22:49:25 +0200 |
---|---|---|
committer | Paul Adenot <[email protected]> | 2024-01-08 11:31:04 +0100 |
commit | ffec8ede4c8ab15c0db3043c793b0c82e299e14d (patch) | |
tree | 9285b325c52c2a630539c7730ef44802b3ff0861 /src | |
parent | ed2efe22cb803f022b5a38fbbc53eec250056874 (diff) | |
download | cubeb-ffec8ede4c8ab15c0db3043c793b0c82e299e14d.tar.gz cubeb-ffec8ede4c8ab15c0db3043c793b0c82e299e14d.zip |
Checking buffer, buffer_in, buffer_out pointers for non NULL values
Diffstat (limited to 'src')
-rw-r--r-- | src/cubeb_jack.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/cubeb_jack.cpp b/src/cubeb_jack.cpp index 6f921d6..218d7e4 100644 --- a/src/cubeb_jack.cpp +++ b/src/cubeb_jack.cpp @@ -431,8 +431,10 @@ cbjack_process(jack_nframes_t nframes, void * arg) if (stm->devs & OUT_ONLY) { for (unsigned int c = 0; c < stm->out_params.channels; c++) { float * buffer_out = bufs_out[c]; - for (long f = 0; f < nframes; f++) { - buffer_out[f] = 0.f; + if (buffer_out) { + for (long f = 0; f < nframes; f++) { + buffer_out[f] = 0.f; + } } } } @@ -440,8 +442,10 @@ cbjack_process(jack_nframes_t nframes, void * arg) // paused, capture silence for (unsigned int c = 0; c < stm->in_params.channels; c++) { float * buffer_in = bufs_in[c]; - for (long f = 0; f < nframes; f++) { - buffer_in[f] = 0.f; + if (buffer_in) { + for (long f = 0; f < nframes; f++) { + buffer_in[f] = 0.f; + } } } } @@ -493,8 +497,10 @@ cbjack_process(jack_nframes_t nframes, void * arg) if (stm->devs & OUT_ONLY) { for (unsigned int c = 0; c < stm->out_params.channels; c++) { float * buffer_out = bufs_out[c]; - for (long f = 0; f < nframes; f++) { - buffer_out[f] = 0.f; + if (buffer_out) { + for (long f = 0; f < nframes; f++) { + buffer_out[f] = 0.f; + } } } } @@ -502,8 +508,10 @@ cbjack_process(jack_nframes_t nframes, void * arg) // capture silence for (unsigned int c = 0; c < stm->in_params.channels; c++) { float * buffer_in = bufs_in[c]; - for (long f = 0; f < nframes; f++) { - buffer_in[f] = 0.f; + if (buffer_in) { + for (long f = 0; f < nframes; f++) { + buffer_in[f] = 0.f; + } } } } @@ -542,20 +550,26 @@ cbjack_deinterleave_playback_refill_float(cubeb_stream * stream, float ** in, for (unsigned int c = 0; c < stream->out_params.channels; c++) { float * buffer = bufs_out[c]; for (long f = 0; f < done_frames; f++) { - buffer[f] = - out_interleaved_buffer[(f * stream->out_params.channels) + c] * - stream->volume; + if (buffer) { + buffer[f] = + out_interleaved_buffer[(f * stream->out_params.channels) + c] * + stream->volume; + } } if (done_frames < needed_frames) { // draining for (long f = done_frames; f < needed_frames; f++) { - buffer[f] = 0.f; + if (buffer) { + buffer[f] = 0.f; + } } } if (done_frames == 0) { // stop, but first zero out the existing buffer for (long f = 0; f < needed_frames; f++) { - buffer[f] = 0.f; + if (buffer) { + buffer[f] = 0.f; + } } } } |