mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-24 08:56:42 -05:00
commit
fc33f7ee97
56 changed files with 510 additions and 335 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <pulse/rtclock.h>
|
||||
#include <pulse/timeval.h>
|
||||
#include <pulse/util.h>
|
||||
#include <pulse/version.h>
|
||||
|
|
@ -50,7 +51,7 @@
|
|||
#include <pulsecore/time-smoother.h>
|
||||
#include <pulsecore/thread.h>
|
||||
#include <pulsecore/thread-mq.h>
|
||||
#include <pulsecore/rtclock.h>
|
||||
#include <pulsecore/core-rtclock.h>
|
||||
#include <pulsecore/core-error.h>
|
||||
#include <pulsecore/proplist-util.h>
|
||||
#include <pulsecore/auth-cookie.h>
|
||||
|
|
@ -112,7 +113,7 @@ static const char* const valid_modargs[] = {
|
|||
|
||||
#define DEFAULT_TIMEOUT 5
|
||||
|
||||
#define LATENCY_INTERVAL 10
|
||||
#define LATENCY_INTERVAL (10*PA_USEC_PER_SEC)
|
||||
|
||||
#define MIN_NETWORK_LATENCY_USEC (8*PA_USEC_PER_MSEC)
|
||||
|
||||
|
|
@ -395,7 +396,7 @@ static void check_smoother_status(struct userdata *u, pa_bool_t past) {
|
|||
|
||||
pa_assert(u);
|
||||
|
||||
x = pa_rtclock_usec();
|
||||
x = pa_rtclock_now();
|
||||
|
||||
/* Correct by the time the requested issued needs to travel to the
|
||||
* other side. This is a valid thread-safe access, because the
|
||||
|
|
@ -500,7 +501,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
|||
pa_usec_t yl, yr, *usec = data;
|
||||
|
||||
yl = pa_bytes_to_usec((uint64_t) u->counter, &u->sink->sample_spec);
|
||||
yr = pa_smoother_get(u->smoother, pa_rtclock_usec());
|
||||
yr = pa_smoother_get(u->smoother, pa_rtclock_now());
|
||||
|
||||
*usec = yl > yr ? yl - yr : 0;
|
||||
return 0;
|
||||
|
|
@ -533,7 +534,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
|
|||
else
|
||||
y = 0;
|
||||
|
||||
pa_smoother_put(u->smoother, pa_rtclock_usec(), y);
|
||||
pa_smoother_put(u->smoother, pa_rtclock_now(), y);
|
||||
|
||||
/* We can access this freely here, since the main thread is waiting for us */
|
||||
u->thread_transport_usec = u->transport_usec;
|
||||
|
|
@ -607,7 +608,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
|
|||
pa_usec_t yr, yl, *usec = data;
|
||||
|
||||
yl = pa_bytes_to_usec((uint64_t) u->counter, &PA_SOURCE(o)->sample_spec);
|
||||
yr = pa_smoother_get(u->smoother, pa_rtclock_usec());
|
||||
yr = pa_smoother_get(u->smoother, pa_rtclock_now());
|
||||
|
||||
*usec = yr > yl ? yr - yl : 0;
|
||||
return 0;
|
||||
|
|
@ -633,7 +634,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
|
|||
y = pa_bytes_to_usec((uint64_t) u->counter, &u->source->sample_spec);
|
||||
y += (pa_usec_t) offset;
|
||||
|
||||
pa_smoother_put(u->smoother, pa_rtclock_usec(), y);
|
||||
pa_smoother_put(u->smoother, pa_rtclock_now(), y);
|
||||
|
||||
/* We can access this freely here, since the main thread is waiting for us */
|
||||
u->thread_transport_usec = u->transport_usec;
|
||||
|
|
@ -877,9 +878,8 @@ static void request_latency(struct userdata *u) {
|
|||
}
|
||||
|
||||
/* Called from main context */
|
||||
static void timeout_callback(pa_mainloop_api *m, pa_time_event*e, const struct timeval *tv, void *userdata) {
|
||||
static void timeout_callback(pa_mainloop_api *m, pa_time_event *e, const struct timeval *t, void *userdata) {
|
||||
struct userdata *u = userdata;
|
||||
struct timeval ntv;
|
||||
|
||||
pa_assert(m);
|
||||
pa_assert(e);
|
||||
|
|
@ -887,9 +887,7 @@ static void timeout_callback(pa_mainloop_api *m, pa_time_event*e, const struct
|
|||
|
||||
request_latency(u);
|
||||
|
||||
pa_gettimeofday(&ntv);
|
||||
ntv.tv_sec += LATENCY_INTERVAL;
|
||||
m->time_restart(e, &ntv);
|
||||
pa_core_rttime_restart(u->core, e, pa_rtclock_now() + LATENCY_INTERVAL);
|
||||
}
|
||||
|
||||
/* Called from main context */
|
||||
|
|
@ -1356,7 +1354,6 @@ static void start_subscribe(struct userdata *u) {
|
|||
/* Called from main context */
|
||||
static void create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
|
||||
struct userdata *u = userdata;
|
||||
struct timeval ntv;
|
||||
#ifdef TUNNEL_SINK
|
||||
uint32_t bytes;
|
||||
#endif
|
||||
|
|
@ -1438,9 +1435,7 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t
|
|||
request_info(u);
|
||||
|
||||
pa_assert(!u->time_event);
|
||||
pa_gettimeofday(&ntv);
|
||||
ntv.tv_sec += LATENCY_INTERVAL;
|
||||
u->time_event = u->core->mainloop->time_new(u->core->mainloop, &ntv, timeout_callback, u);
|
||||
u->time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + LATENCY_INTERVAL, timeout_callback, u);
|
||||
|
||||
request_latency(u);
|
||||
|
||||
|
|
@ -1705,7 +1700,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
|
|||
}
|
||||
|
||||
u->pstream = pa_pstream_new(u->core->mainloop, io, u->core->mempool);
|
||||
u->pdispatch = pa_pdispatch_new(u->core->mainloop, command_table, PA_COMMAND_MAX);
|
||||
u->pdispatch = pa_pdispatch_new(u->core->mainloop, TRUE, command_table, PA_COMMAND_MAX);
|
||||
|
||||
pa_pstream_set_die_callback(u->pstream, pstream_die_callback, u);
|
||||
pa_pstream_set_recieve_packet_callback(u->pstream, pstream_packet_callback, u);
|
||||
|
|
@ -1824,7 +1819,7 @@ int pa__init(pa_module*m) {
|
|||
TRUE,
|
||||
TRUE,
|
||||
10,
|
||||
pa_rtclock_usec(),
|
||||
pa_rtclock_now(),
|
||||
FALSE);
|
||||
u->ctag = 1;
|
||||
u->device_index = u->channel = PA_INVALID_INDEX;
|
||||
|
|
@ -1852,7 +1847,7 @@ int pa__init(pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (!(u->client = pa_socket_client_new_string(m->core->mainloop, u->server_name, PA_NATIVE_DEFAULT_PORT))) {
|
||||
if (!(u->client = pa_socket_client_new_string(m->core->mainloop, TRUE, u->server_name, PA_NATIVE_DEFAULT_PORT))) {
|
||||
pa_log("Failed to connect to server '%s'", u->server_name);
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue