diff options
author | Misaki Kasumi <misakikasumi@outlook.com> | 2024-03-31 07:29:59 +0800 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2024-03-31 12:57:52 +0200 |
commit | 3086f8fa3e2c7bac996b4134095aa500c8ae3fab (patch) | |
tree | c1ba858e7d361aa638ec6ae18571e98041c15ef5 | |
parent | 765a43a0ffcf4b89ea38ee3181b8039f823d9da6 (diff) | |
download | mpv-3086f8fa3e2c7bac996b4134095aa500c8ae3fab.tar.bz2 mpv-3086f8fa3e2c7bac996b4134095aa500c8ae3fab.tar.xz |
ao_pipewire: fix nframes calculation
`buf` contains a `struct spa_data` for each channel.
Therefore the number of channels does not matter to calculate the frame capacity of one `struct spa_data`.
In practice this shouldn't make a difference as `b->requested` would reduce nframes even more.
-rw-r--r-- | audio/out/ao_pipewire.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index c7d7ca6cb6..ee97e8f8e8 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -173,8 +173,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); |