libao: update ao_pulse.c.patch

This commit is contained in:
Tom Yan 2019-10-07 21:47:28 +08:00
parent 2f8ad960c0
commit 70a8df67e7
2 changed files with 29 additions and 6 deletions

View File

@ -1,15 +1,37 @@
--- ../cache/libao-1.2.2/src/plugins/pulse/ao_pulse.c 2016-11-14 16:03:30.000000000 +0800
+++ ./src/plugins/pulse/ao_pulse.c 2018-08-02 00:59:31.723282524 +0800
@@ -40,7 +40,7 @@
diff --git a/src/plugins/pulse/ao_pulse.c b/src/plugins/pulse/ao_pulse.c
index 2d10d57..6780830 100644
--- a/src/plugins/pulse/ao_pulse.c
+++ b/src/plugins/pulse/ao_pulse.c
@@ -41,7 +41,7 @@
#include <ao/ao.h>
#include <ao/plugin.h>
-#define AO_PULSE_BUFFER_TIME 20000
+#define AO_PULSE_BUFFER_TIME 50000
+#define AO_PULSE_BUFFER_TIME 20
/* Unfortunately libao doesn't allow "const" for these structures... */
static char * ao_pulse_options[] = {
@@ -255,12 +255,10 @@
@@ -73,7 +73,7 @@ typedef struct ao_pulse_internal {
struct pa_simple *simple;
char *server, *sink, *client_name;
pa_usec_t static_delay;
- pa_usec_t buffer_time;
+ int buffer_time;
} ao_pulse_internal;
/* Yes, this is very ugly, but required nonetheless... */
@@ -174,8 +174,8 @@ int ao_plugin_set_option(ao_device *device, const char *key, const char *value)
} else if (!strcmp(key, "client_name")) {
free(internal->client_name);
internal->client_name = strdup(value);
- }else if (!strcmp(key, "buffer_time")){
- internal->buffer_time = atoi(value) * 1000;
+ } else if (!strcmp(key, "buffer_time")) {
+ internal->buffer_time = atoi(value);
}
return 1;
@@ -256,12 +256,10 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) {
}
/* buffering attributes */
@ -20,7 +42,7 @@
- ((format->bits+7)/8) * device->output_channels;
- battr.minreq = battr.tlength/4;
- battr.maxlength = battr.tlength+battr.minreq;
+ battr.tlength = internal->buffer_time * format->rate / 1000000 *
+ battr.tlength = internal->buffer_time * format->rate / 1000 *
+ (format->bits / 8) * device->output_channels;
internal->simple = pa_simple_new(internal->server, t, PA_STREAM_PLAYBACK,

View File

@ -18,6 +18,7 @@ termux_step_post_make_install () {
mkdir -p $TERMUX_PREFIX/etc/
cat << EOF > $TERMUX_PREFIX/etc/libao.conf
default_driver=pulse
buffer_time=50
quiet
EOF
}