mpv: replace pulse buffer patch
The new one is what accepted upstream ultimately. Functionally they work the same. Just to avoid possible confusion.
This commit is contained in:
parent
43d7d94339
commit
d55d9521aa
|
@ -1,20 +0,0 @@
|
|||
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)
|
|
@ -0,0 +1,19 @@
|
|||
diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c
|
||||
index ed45ba6549..e288841788 100644
|
||||
--- a/audio/out/ao_pulse.c
|
||||
+++ b/audio/out/ao_pulse.c
|
||||
@@ -454,11 +454,11 @@ static int init(struct ao *ao)
|
||||
pa_stream_set_write_callback(priv->stream, stream_request_cb, ao);
|
||||
pa_stream_set_latency_update_callback(priv->stream,
|
||||
stream_latency_update_cb, ao);
|
||||
- int buf_size = af_fmt_seconds_to_bytes(ao->format, priv->cfg_buffer / 1000.0,
|
||||
- ao->channels.num, ao->samplerate);
|
||||
+ uint32_t buf_size = ao->samplerate * (priv->cfg_buffer / 1000.0) *
|
||||
+ af_fmt_to_bytes(ao->format) * ao->channels.num;
|
||||
pa_buffer_attr bufattr = {
|
||||
.maxlength = -1,
|
||||
- .tlength = buf_size > 0 ? buf_size : (uint32_t)-1,
|
||||
+ .tlength = buf_size > 0 ? buf_size : -1,
|
||||
.prebuf = -1,
|
||||
.minreq = -1,
|
||||
.fragsize = -1,
|
Loading…
Reference in New Issue