termux-packages/packages/mpv/pulse-buffer.patch
2018-08-07 12:17:46 +02:00

21 lines
775 B
Diff

diff --git a/audio/format.c b/audio/format.c
index 8a13698..982b9af 100644
--- a/audio/format.c
+++ b/audio/format.c
@@ -137,12 +137,9 @@ const char *af_fmt_to_str(int format)
int af_fmt_seconds_to_bytes(int format, float seconds, int channels, int samplerate)
{
assert(!af_fmt_is_planar(format));
- int bps = af_fmt_to_bytes(format);
- int framelen = channels * bps;
- int bytes = seconds * bps * samplerate;
- if (bytes % framelen)
- bytes += framelen - (bytes % framelen);
- return bytes;
+ // fix --pulse-buffer
+ // https://github.com/termux/termux-packages/pull/2707#issuecomment-410841566
+ return samplerate * seconds * af_fmt_to_bytes(format) * channels;
}
void af_fill_silence(void *dst, size_t bytes, int format)