This commit is contained in:
Oliver Schmidhauser 2018-08-06 22:50:44 +02:00 committed by Fredrik Fornwall
parent 47cdb7f70f
commit 26f487970d

View File

@ -0,0 +1,20 @@
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)