From 4b8eb8588da8f5000bf83fdf2a88e12fc6d73c51 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 7 Feb 2026 10:48:42 +1000 Subject: [PATCH] Resampler: Stop allowing NULL input and output buffers. --- miniaudio.h | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/miniaudio.h b/miniaudio.h index 40098858..66e9c4c2 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -2990,9 +2990,8 @@ De-interleaved processing is not supported. To process frames, use `ma_resampler_process_pcm_frames()`. On input, this function takes the number of output frames you can fit in the output buffer and the number of input frames contained in the input buffer. On output these variables contain the number of output frames that were written to the output buffer -and the number of input frames that were consumed in the process. You can pass in NULL for the -input buffer in which case it will be treated as an infinitely large buffer of zeros. The output -buffer can also be NULL, in which case the processing will be treated as seek. +and the number of input frames that were consumed in the process. You cannot pass in NULL for the +input buffer or output buffer. The sample rate can be changed dynamically on the fly. You can change this with explicit sample rates with `ma_resampler_set_rate()` and also with a decimal ratio with @@ -5721,16 +5720,9 @@ ma_resampler_get_expected_output_frame_count() to know how many output frames wi On input, [pFrameCountIn] contains the number of input frames contained in [pFramesIn]. On output it contains the number of whole input frames that were actually processed. You can use ma_resampler_get_required_input_frame_count() to know how many input frames -you should provide for a given number of output frames. [pFramesIn] can be NULL, in which case zeroes will be used instead. +you should provide for a given number of output frames. [pFramesIn] cannot be NULL. -If [pFramesOut] is NULL, a seek is performed. In this case, if [pFrameCountOut] is not NULL it will seek by the specified number of -output frames. Otherwise, if [pFramesCountOut] is NULL and [pFrameCountIn] is not NULL, it will seek by the specified number of input -frames. When seeking, [pFramesIn] is allowed to NULL, in which case the internal timing state will be updated, but no input will be -processed. In this case, any internal filter state will be updated as if zeroes were passed in. - -It is an error for [pFramesOut] to be non-NULL and [pFrameCountOut] to be NULL. - -It is an error for both [pFrameCountOut] and [pFrameCountIn] to be NULL. +No arguments are allowed to be NULL. */ MA_API ma_result ma_resampler_process_pcm_frames(ma_resampler* pResampler, const void* pFramesIn, ma_uint64* pFrameCountIn, void* pFramesOut, ma_uint64* pFrameCountOut); @@ -60041,7 +60033,7 @@ MA_API ma_result ma_resampler_process_pcm_frames(ma_resampler* pResampler, const return MA_INVALID_ARGS; } - if (pFrameCountOut == NULL && pFrameCountIn == NULL) { + if (pFrameCountOut == NULL || pFramesOut == NULL || pFrameCountIn == NULL || pFramesIn == NULL) { return MA_INVALID_ARGS; }