diff options
Diffstat (limited to 'src/libsink')
| -rw-r--r-- | src/libsink/common.h | 2 | ||||
| -rw-r--r-- | src/libsink/sink.c | 22 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/libsink/common.h b/src/libsink/common.h index c29e494..0bb3ded 100644 --- a/src/libsink/common.h +++ b/src/libsink/common.h @@ -1,6 +1,6 @@ #pragma once -#define CAMU_SINK_LOCAL 0 +#define CAMU_SINK_LOCAL enum { CAMU_SINK_SET = 0, diff --git a/src/libsink/sink.c b/src/libsink/sink.c index da8f47f..2c8790b 100644 --- a/src/libsink/sink.c +++ b/src/libsink/sink.c @@ -136,7 +136,7 @@ static void set_or_queue_entry(struct camu_sink_entry *entry) #endif } -#if CAMU_SINK_LOCAL +#ifdef CAMU_SINK_LOCAL static void sink_local_pause(struct camu_sink *sink, struct camu_sink_entry *entry) { if (camu_clock_is_paused(&entry->clock)) { @@ -236,7 +236,7 @@ static void handle_sink_cmd(struct camu_sink *sink, struct camu_sink_cmd *cmd) break; } case TOGGLE_PAUSE: { -#if CAMU_SINK_LOCAL +#ifdef CAMU_SINK_LOCAL sink_local_pause(sink, (struct camu_sink_entry *)cmd->opaque); #else if (!sink->conn) return; @@ -468,7 +468,7 @@ static void video_buffer_callback(void *userdata, u8 op) static void evaluate_latency(struct camu_sink *sink, struct camu_sink_entry *entry) { -#if CAMU_SINK_LOCAL +#ifdef CAMU_SINK_LOCAL #ifndef CAMU_SINK_NO_VIDEO // Entry has both audio and video configured. if (!BUFFER_EMPTY(&entry->audio) && !BUFFER_EMPTY(&entry->video)) { @@ -482,9 +482,11 @@ static void evaluate_latency(struct camu_sink *sink, struct camu_sink_entry *ent // To sync clients with differing audio latencies our only option is to factor the mixer // latency directly into the audio buffer. f64 audio = camu_mixer_get_latency(sink->audio.mixer); - s32 frames = audio / entry->video.buf.avg_frame_duration; - frames += sink->video.renderer->get_latency(sink->video.renderer); - camu_video_buffer_set_latency(&entry->video.buf, frames); + if (!BUFFER_EMPTY(&entry->video)) { + s32 frames = audio / entry->video.buf.avg_frame_duration; + frames += sink->video.renderer->get_latency(sink->video.renderer); + camu_video_buffer_set_latency(&entry->video.buf, frames); + } camu_audio_buffer_set_latency(&entry->audio.buf, audio); #endif } @@ -788,7 +790,7 @@ static bool set_command_callback(void *userdata, struct aki_rpc_connection *conn aki_mutex_lock(&sink->mutex); u8 op = aki_packet_read_u8(packet); -#if CAMU_SINK_LOCAL +#ifdef CAMU_SINK_LOCAL if (op == LIANA_SINK_UNSET) { if (sink->current) { remove_entry_buffers(sink, sink->current); @@ -839,7 +841,7 @@ static bool set_command_callback(void *userdata, struct aki_rpc_connection *conn goto out; } -#if CAMU_SINK_LOCAL +#ifdef CAMU_SINK_LOCAL (void)at; (void)pause; if (sink->current && !camu_clock_is_paused(&sink->current->clock)) { @@ -944,7 +946,7 @@ static bool pause_command_callback(void *userdata, struct aki_rpc_connection *co struct camu_sink_entry *current = sink->current; if (!current) goto out; -#if CAMU_SINK_LOCAL +#ifdef CAMU_SINK_LOCAL (void)sequence; (void)at; (void)pause; @@ -990,7 +992,7 @@ static bool seek_command_callback(void *userdata, struct aki_rpc_connection *con if (current->sequence == sequence) { current->ended = false; -#if CAMU_SINK_LOCAL +#ifdef CAMU_SINK_LOCAL (void)at; lia_client_seek(¤t->client, pos, 0); #else |