Skip to content

Commit

Permalink
ao_pipewire: fix buffer size calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihe774 committed Mar 26, 2024
1 parent 415ad7f commit 089f209
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions audio/out/ao_pipewire.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ static void on_process(void *userdata)

struct spa_buffer *buf = b->buffer;

int bytes_per_channel = buf->datas[0].maxsize / ao->channels.num;
int nframes = bytes_per_channel / ao->sstride;
int nframes = buf->datas[0].maxsize / ao->sstride;
#if PW_CHECK_VERSION(0, 3, 49)
if (b->requested != 0)
nframes = MPMIN(b->requested, nframes);
Expand Down Expand Up @@ -242,7 +241,7 @@ static void on_param_changed(void *userdata, uint32_t id, const struct spa_pod *
if (param == NULL || id != SPA_PARAM_Format)
return;

int buffer_size = ao->device_buffer * af_fmt_to_bytes(ao->format) * ao->channels.num;
int buffer_size = ao->device_buffer * ao->sstride;

params[0] = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
Expand Down

0 comments on commit 089f209

Please sign in to comment.