mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-16 06:29:56 +00:00
pw-cat: calculate number of samples properly with io_rate_match
Fixes wrong buffer sizes when adapter is configured in passthrough mode.
This commit is contained in:
parent
a701a500af
commit
34b1ecc244
|
@ -153,6 +153,7 @@ struct data {
|
|||
int sync;
|
||||
|
||||
struct spa_io_position *position;
|
||||
struct spa_io_rate_match *rate_match;
|
||||
bool drained;
|
||||
uint64_t clock_time;
|
||||
|
||||
|
@ -849,6 +850,9 @@ on_io_changed(void *userdata, uint32_t id, void *data, uint32_t size)
|
|||
case SPA_IO_Position:
|
||||
d->position = data;
|
||||
break;
|
||||
case SPA_IO_RateMatch:
|
||||
d->rate_match = data;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -887,6 +891,8 @@ static void on_process(void *userdata)
|
|||
if (data->mode == mode_playback) {
|
||||
|
||||
n_frames = d->maxsize / data->stride;
|
||||
if (data->rate_match && data->rate_match->size > 0)
|
||||
n_frames = SPA_MIN((uint32_t)n_frames, data->rate_match->size);
|
||||
|
||||
n_fill_frames = data->fill(data, p, n_frames);
|
||||
|
||||
|
|
Loading…
Reference in a new issue