From bfb5e03e833d22604fa3ff32ef807189cc732471 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 28 Jan 2022 12:11:42 -0500 Subject: [PATCH] pacat: Make writes be frame-aligned, even for raw mode This will be aligned to the fake sample spec corresponding to the format, but that is correct and will prevent breakage in libpulse and the server where we have aligned-ness expectations. --- src/utils/pacat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/pacat.c b/src/utils/pacat.c index 2a6a445f6..5bbf135a6 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -1060,6 +1060,9 @@ int main(int argc, char *argv[]) { pa_format_info_set_rate(formats[0], sample_spec.rate); pa_format_info_set_channels(formats[0], sample_spec.channels); + /* Fix up the sample spec based on the format we have */ + pa_format_info_to_sample_spec(formats[0], &sample_spec, NULL); + if (!pa_format_info_valid(formats[0])) { pa_log(_("Invalid format specification.")); goto quit; @@ -1229,7 +1232,7 @@ int main(int argc, char *argv[]) { } } - if (raw && !encoding_set && mode == PLAYBACK) + if (raw && mode == PLAYBACK) partialframe_buf = pa_xmalloc(pa_frame_size(&sample_spec)); /* Set up a new main loop */