summaryrefslogtreecommitdiff
path: root/src/libsink
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-12-26 11:25:14 -0500
committerAndrew Opalach <andrew@akon.city> 2024-12-26 11:25:14 -0500
commit9026e7f49f11e920eac666bd4159ec459b979623 (patch)
tree999ae6fdf5ea4dbad5e777818a176a6b2d564553 /src/libsink
parent7021f0625cc018af58d61d7875fbeb21b64d99bf (diff)
downloadcamu-9026e7f49f11e920eac666bd4159ec459b979623.tar.gz
camu-9026e7f49f11e920eac666bd4159ec459b979623.tar.bz2
camu-9026e7f49f11e920eac666bd4159ec459b979623.zip
Incomplete buffer errored and sink queued
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/libsink')
-rw-r--r--src/libsink/sink.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/libsink/sink.c b/src/libsink/sink.c
index 984a41c..9b5c05e 100644
--- a/src/libsink/sink.c
+++ b/src/libsink/sink.c
@@ -348,11 +348,11 @@ static void queue_signal_callback(void *userdata)
struct camu_sink *sink = (struct camu_sink *)userdata;
u32 size;
struct camu_sink_cmd cmd;
- do {
+ for (;;) {
camu_queue_try_pop(sink->queue, size, cmd);
if (size == 0) break;
handle_sink_cmd(sink, &cmd);
- } while (1);
+ }
}
static void queue_cmd(struct camu_sink *sink, struct camu_sink_cmd cmd)
@@ -436,11 +436,10 @@ static void maybe_add_to_previous(struct camu_sink *sink, struct camu_sink_entry
// If neither the entries audio or video buffer is ADDED, we don't care about adding it
// to previous (waiting for the next added entry to remove it).
#ifndef CAMU_SINK_NO_VIDEO
- if (!(previous->audio.state == BUFFER_ADDED || previous->video.state == BUFFER_ADDED))
+ if (!(previous->audio.state == BUFFER_ADDED || previous->video.state == BUFFER_ADDED) || target->ended) {
#else
- if (!(previous->audio.state == BUFFER_ADDED))
+ if (!(previous->audio.state == BUFFER_ADDED) || target->ended)
#endif
- {
remove_entry_buffers(sink, previous);
return;
}
@@ -586,11 +585,7 @@ static void switch_to(struct camu_sink *sink, struct camu_sink_entry *target)
al_assert(current != target);
if (!current->ended) {
- if (target->ended) {
- remove_entry_buffers(sink, current);
- } else {
- maybe_add_to_previous(sink, current, target);
- }
+ maybe_add_to_previous(sink, current, target);
} else {
#ifndef CAMU_SINK_NO_VIDEO
if (ENTRY_IS_SINGLE_FRAME(current)) {
@@ -645,9 +640,11 @@ static bool end_entry_and_advance_queue(struct camu_sink *sink, struct camu_sink
switch_to(sink, sink->target);
sink->target = NULL;
return true;
- }/* else if (sink->queued) {
+ } else if (sink->queued) {
+ switch_to(sink, sink->queued);
+ sink->queued = NULL;
return true;
- }*/
+ }
return false;
}
@@ -698,6 +695,8 @@ static void audio_buffer_callback(void *userdata, u8 op)
nn_mutex_unlock(&sink->mutex);
break;
}
+ case CAMU_BUFFER_ERRORED:
+ break;
}
}
@@ -743,6 +742,8 @@ static void video_buffer_callback(void *userdata, u8 op)
}
break;
}
+ case CAMU_BUFFER_ERRORED:
+ break;
}
}
#endif
@@ -1031,9 +1032,9 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str
}
// If current was never fully added we need to do this here.
maybe_remove_previous(sink);
- }/* else if (entry == sink->queued) {
+ } else if (entry == sink->queued) {
sink->queued = NULL;
- }*/
+ }
lia_client_free(&entry->client);
camu_audio_buffer_free(&entry->audio.buf);
@@ -1118,9 +1119,7 @@ static bool set_command_callback(void *userdata, struct nn_rpc_connection *conn,
u64 at = nn_packet_read_u64(packet);
u64 seek_pos = nn_packet_read_u64(packet);
u8 pause = nn_packet_read_u8(packet);
- bool previous_ended = nn_packet_read_bool(packet);
bool ended = nn_packet_read_bool(packet);
- (void)previous_ended;
bool created = false;
struct camu_sink_entry *entry = get_entry_from_id(sink, id);
@@ -1149,10 +1148,13 @@ static bool set_command_callback(void *userdata, struct nn_rpc_connection *conn,
if (op == LIANA_SINK_BUFFER) {
goto out;
- }/* else if (op == LIANA_SINK_BUFFER_AND_QUEUE) {
+ } else if (op == LIANA_SINK_BUFFER_AND_QUEUE) {
+ if (pause == LIANA_PAUSE_RESUME) {
+ camu_clock_resume(&entry->clock, at);
+ }
sink->queued = entry;
goto out;
- }*/
+ }
#ifdef CAMU_SINK_LOCAL
(void)at;