audiobuffersplit: Calculate the correct size for fixed size buffers

Fix the output-buffer-size property to do what it says by calculating
the correct audio buffer size for that target size, rounded down to
the nearest whole number of samples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1887>
This commit is contained in:
Jan Schmidt 2020-12-17 04:41:18 +11:00
parent c123b79900
commit 1b3ba87d13

View file

@ -230,8 +230,9 @@ gst_audio_buffer_split_update_samples_per_buffer (GstAudioBufferSplit * self)
} }
if (self->output_buffer_size) { if (self->output_buffer_size) {
self->output_buffer_duration_n = GST_AUDIO_INFO_BPF (&self->info); self->output_buffer_duration_n =
self->output_buffer_duration_d = self->output_buffer_size; self->output_buffer_size / GST_AUDIO_INFO_BPF (&self->info);
self->output_buffer_duration_d = GST_AUDIO_INFO_RATE (&self->info);
} }
self->samples_per_buffer = self->samples_per_buffer =