diff options
| author | 2025-01-05 20:42:51 -0500 | |
|---|---|---|
| committer | 2025-01-05 20:42:51 -0500 | |
| commit | 240ee00a9177d6ff80ef48ce577b06d93cb554c2 (patch) | |
| tree | 0f759e7a9fe28ae0d21a54917ca893131aef9dda /src/libsink | |
| parent | 9362f2223038b59954c8402963932b4eb77030be (diff) | |
| download | camu-240ee00a9177d6ff80ef48ce577b06d93cb554c2.tar.gz camu-240ee00a9177d6ff80ef48ce577b06d93cb554c2.tar.bz2 camu-240ee00a9177d6ff80ef48ce577b06d93cb554c2.zip | |
Temp fix for stream selection, compile fixes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/libsink')
| -rw-r--r-- | src/libsink/sink.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/libsink/sink.c b/src/libsink/sink.c index 97f1d66..03f76b7 100644 --- a/src/libsink/sink.c +++ b/src/libsink/sink.c @@ -65,11 +65,6 @@ enum { #define VIDEO_EMPTY(entry) BUFFER_EMPTY(&(entry)->video) #endif -#define AUDIO_NOT_EMPTY(entry) BUFFER_NOT_EMPTY(&(entry)->audio) -#ifndef CAMU_SINK_NO_VIDEO -#define VIDEO_NOT_EMPTY(entry) BUFFER_NOT_EMPTY(&(entry)->video) -#endif - #define AUDIO_ADDED_OR_EMPTY(entry) ((entry)->audio.state == BUFFER_ADDED || BUFFER_EMPTY(&(entry)->audio)) #ifndef CAMU_SINK_NO_VIDEO #define VIDEO_ADDED_OR_EMPTY(entry) ((entry)->video.state == BUFFER_ADDED || BUFFER_EMPTY(&(entry)->video)) @@ -237,7 +232,7 @@ static void sink_local_pause(struct camu_sink *sink, struct camu_sink_entry *ent if (camu_clock_is_paused(&entry->clock)) { entry->audio.buffer_paused = false; camu_clock_resume(&entry->clock, 0); - if (AUDIO_NOT_EMPTY(entry) && sink->audio.state == SINK_PAUSED) { + if (!AUDIO_EMPTY(entry) && sink->audio.state == SINK_PAUSED) { sink->callback(sink->userdata, CAMU_SINK_START, CAMU_SINK_AUDIO, NULL); sink->audio.state = SINK_PLAYING; } @@ -790,6 +785,7 @@ static void audio_buffer_callback(void *userdata, u8 op) break; } case CAMU_BUFFER_ERRORED: + al_log_error("sink", "Audio buffer errored."); break; } } @@ -817,7 +813,7 @@ static void video_buffer_callback(void *userdata, u8 op) bool swapped = false; nn_mutex_lock(&sink->mutex); al_log_info("sink", "Video EOF."); - if (AUDIO_NOT_EMPTY(entry)) { + if (!AUDIO_EMPTY(entry)) { camu_audio_buffer_set_no_video(&entry->audio.buf, true); } if (!VIDEO_IS_SINGLE_FRAME(entry)) { @@ -840,6 +836,7 @@ static void video_buffer_callback(void *userdata, u8 op) break; } case CAMU_BUFFER_ERRORED: + al_log_error("sink", "Video buffer errored."); break; } } @@ -874,7 +871,7 @@ static void evaluate_latency(struct camu_sink *sink, struct camu_sink_entry *ent { #ifdef CAMU_SINK_LOCAL #ifndef CAMU_SINK_NO_VIDEO - if (AUDIO_NOT_EMPTY(entry) && VIDEO_NOT_EMPTY(entry)) { + if (!AUDIO_EMPTY(entry) && !VIDEO_EMPTY(entry)) { 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); @@ -889,7 +886,7 @@ static void evaluate_latency(struct camu_sink *sink, struct camu_sink_entry *ent // latency directly into the audio buffer. f64 audio = camu_mixer_get_latency(sink->audio.mixer); #ifndef CAMU_SINK_NO_VIDEO - if (VIDEO_NOT_EMPTY(entry)) { + if (!VIDEO_EMPTY(entry)) { 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); @@ -933,7 +930,7 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str } else if (entry->audio.state == BUFFER_INIT) { entry->audio.state = BUFFER_CONFIGURED; } else { - assert(false); + al_assert(false); } if (VIDEO_ADDED_OR_EMPTY(entry)) { evaluate_latency(sink, entry); @@ -954,7 +951,7 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str } else if (entry->video.state == BUFFER_INIT) { entry->video.state = BUFFER_CONFIGURED; } else { - assert(false); + al_assert(false); } if (AUDIO_ADDED_OR_EMPTY(entry)) { evaluate_latency(sink, entry); @@ -985,14 +982,14 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str struct camu_codec_frame *frame = (struct camu_codec_frame *)opaque; switch (stream->type) { case CAMU_STREAM_AUDIO: - if (AUDIO_NOT_EMPTY(entry)) { + if (!AUDIO_EMPTY(entry)) { camu_audio_buffer_push(&entry->audio.buf, frame); return; } break; #ifndef CAMU_SINK_NO_VIDEO case CAMU_STREAM_VIDEO: - if (VIDEO_NOT_EMPTY(entry)) { + if (!VIDEO_EMPTY(entry)) { camu_video_buffer_push(&entry->video.buf, frame); return; } @@ -1074,11 +1071,11 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str ) { BLOCKING_SLEEP(NNWT_TS_FROM_USEC(2000)); } if (reconnect) { - if (AUDIO_NOT_EMPTY(entry)) { + if (!AUDIO_EMPTY(entry)) { camu_audio_buffer_reset(&entry->audio.buf); } #ifndef CAMU_SINK_NO_VIDEO - if (VIDEO_NOT_EMPTY(entry) && !ignore_video) { + if (!VIDEO_EMPTY(entry) && !ignore_video) { camu_video_buffer_reset(&entry->video.buf); } #endif @@ -1122,7 +1119,7 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str case LIANA_CLIENT_EOF: { switch (stream->type) { case CAMU_STREAM_AUDIO: { - if (AUDIO_NOT_EMPTY(entry)) { + if (!AUDIO_EMPTY(entry)) { camu_audio_buffer_flush(&entry->audio.buf); } break; @@ -1130,7 +1127,7 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str #ifndef CAMU_SINK_NO_VIDEO case CAMU_STREAM_VIDEO: { // Single frames are immediately flushed inside the buffer. - if (VIDEO_NOT_EMPTY(entry) && !VIDEO_IS_SINGLE_FRAME(entry)) { + if (!VIDEO_EMPTY(entry) && !VIDEO_IS_SINGLE_FRAME(entry)) { camu_video_buffer_flush(&entry->video.buf); } break; |