Skip to content

Commit f5ccb90

Browse files
committed
pulse: avoid unnecessary calculation
1 parent 0cdf82e commit f5ccb90

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/plugins/pulse/ao_pulse.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include <ao/ao.h>
4242
#include <ao/plugin.h>
4343

44-
#define AO_PULSE_BUFFER_TIME 50000
44+
#define AO_PULSE_BUFFER_TIME 50
4545

4646
/* Unfortunately libao doesn't allow "const" for these structures... */
4747
static char * ao_pulse_options[] = {
@@ -73,7 +73,7 @@ typedef struct ao_pulse_internal {
7373
struct pa_simple *simple;
7474
char *server, *sink, *client_name;
7575
pa_usec_t static_delay;
76-
pa_usec_t buffer_time;
76+
int buffer_time;
7777
} ao_pulse_internal;
7878

7979
/* 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)
174174
} else if (!strcmp(key, "client_name")) {
175175
free(internal->client_name);
176176
internal->client_name = strdup(value);
177-
}else if (!strcmp(key, "buffer_time")){
178-
internal->buffer_time = atoi(value) * 1000;
177+
} else if (!strcmp(key, "buffer_time")) {
178+
internal->buffer_time = atoi(value);
179179
}
180180

181181
return 1;
@@ -258,7 +258,7 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) {
258258
/* buffering attributes */
259259
battr.prebuf = battr.minreq = battr.fragsize = battr.maxlength = -1;
260260

261-
battr.tlength = internal->buffer_time * format->rate / 1000000 *
261+
battr.tlength = internal->buffer_time * format->rate / 1000 *
262262
(format->bits / 8) * device->output_channels;
263263

264264
internal->simple = pa_simple_new(internal->server, t, PA_STREAM_PLAYBACK,

0 commit comments

Comments
 (0)