diff options
| -rw-r--r-- | src/libsink/sink.c | 34 | ||||
| -rw-r--r-- | src/libsink/sink.h | 4 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/libsink/sink.c b/src/libsink/sink.c index aa9542e..7b173a9 100644 --- a/src/libsink/sink.c +++ b/src/libsink/sink.c @@ -695,17 +695,17 @@ static void switch_to(struct camu_sink *sink, struct camu_sink_entry *target) bool ensure_removed = false; if (current) { - struct camu_sink_entry *detached = sink->detached; + struct camu_sink_entry *suspended = sink->suspended; al_assert(current != target); - ensure_removed = detached || current->ended; - if (detached) { - al_assert(detached == current); + ensure_removed = suspended || current->ended; + if (suspended) { + al_assert(suspended == current); // A buffer's state being QUEUED should be impossible while it's - // entry is reconnecting. - al_assert(AUDIO_STATE(detached) != BUFFER_QUEUED); - al_assert(VIDEO_STATE(detached) != BUFFER_QUEUED); - sink->detached = NULL; - log_warn("Unset detached as a substitute for remove."); + // entry is suspended. + al_assert(AUDIO_STATE(suspended) != BUFFER_QUEUED); + al_assert(VIDEO_STATE(suspended) != BUFFER_QUEUED); + sink->suspended = NULL; + log_warn("Unset suspended entry as a substitute for remove."); } else if (!current->ended) { maybe_add_to_previous(sink, current, target); } @@ -1119,7 +1119,7 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str // If this entry is still current on CLIENT_RECONNECTED, re-add it's buffers. if (entry == sink->current && rec->reconnect) { - sink->detached = entry; + sink->suspended = entry; } // This entry might be in previous if it was added to previous then, @@ -1241,8 +1241,8 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str case LIANA_CLIENT_RECONNECTED: { struct lia_reconnect_info *rec = (struct lia_reconnect_info *)opaque; nn_mutex_lock(&sink->lock); - log_trace("reconnected("ENTRY_FMT"), detached: "ENTRY_FMT", audio_state: %hhu, video_state: %hhu.", ENTRY_ARG(entry), ENTRY_ARG(sink->detached), AUDIO_STATE(entry), VIDEO_STATE(entry)); - if (entry == sink->detached) { + log_trace("reconnected("ENTRY_FMT"), suspended: "ENTRY_FMT", audio_state: %hhu, video_state: %hhu.", ENTRY_ARG(entry), ENTRY_ARG(sink->suspended), AUDIO_STATE(entry), VIDEO_STATE(entry)); + if (entry == sink->suspended) { al_assert(entry == sink->current); // Let this be the only other explicit BUFFER_ENDED check, or this will // become too complicated. @@ -1263,7 +1263,7 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str } else if (!VIDEO_EMPTY(entry) && !VIDEO_IS_SINGLE_FRAME(entry)) { add_video_if_set_and_buffered(entry); } - sink->detached = NULL; + sink->suspended = NULL; } nn_mutex_unlock(&sink->lock); break; @@ -1308,9 +1308,9 @@ static void client_callback(void *userdata, u8 op, struct camu_codec_stream *str sink->target = (struct camu_sink_entry *)0xb00b; log_warn("Attempting to handle a disconnected target."); } else if (entry == sink->current) { - if (sink->detached) { - al_assert(sink->detached == sink->current); - sink->detached = NULL; + if (sink->suspended) { + al_assert(sink->suspended == sink->current); + sink->suspended = NULL; } if (sink->target) { switch_to(sink, sink->target); @@ -1707,7 +1707,7 @@ bool camu_sink_init(struct camu_sink *sink, struct nn_event_loop *loop, sink->current = NULL; sink->queued = NULL; sink->target = NULL; - sink->detached = NULL; + sink->suspended = NULL; al_array_init(sink->previous); al_array_init(sink->entries); // Start high to exercise the wrapping path. diff --git a/src/libsink/sink.h b/src/libsink/sink.h index f2ae20f..2c96313 100644 --- a/src/libsink/sink.h +++ b/src/libsink/sink.h @@ -91,8 +91,8 @@ struct camu_sink { struct camu_sink_entry *current; struct camu_sink_entry *queued; struct camu_sink_entry *target; - // @TODO: Rename detached to reconnecing. - struct camu_sink_entry *detached; + // If an entry that was current was removed for a reconnect, it's "suspended". + struct camu_sink_entry *suspended; array(struct camu_sink_entry *) previous; array(struct camu_sink_entry *) entries; u16 lru; |