diff options
Diffstat (limited to 'audio/audio_template.h')
-rw-r--r-- | audio/audio_template.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/audio/audio_template.h b/audio/audio_template.h index a0b653f52c..0d8aab6fad 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -138,6 +138,12 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw) return -1; } + /* + * Allocate one additional audio frame that is needed for upsampling + * if the resample buffer size is small. For large buffer sizes take + * care of overflows. + */ + samples = samples < INT_MAX ? samples + 1 : INT_MAX; sw->resample_buf.buffer = g_new0(st_sample, samples); sw->resample_buf.size = samples; sw->resample_buf.pos = 0; |