summaryrefslogtreecommitdiff
path: root/src/libsink
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsink')
-rw-r--r--src/libsink/sink.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libsink/sink.c b/src/libsink/sink.c
index b5e2a65..54f651b 100644
--- a/src/libsink/sink.c
+++ b/src/libsink/sink.c
@@ -795,11 +795,18 @@ static void audio_buffer_callback(void *userdata, u8 op)
case CAMU_BUFFER_EOF: {
nn_mutex_lock(&sink->mutex);
al_log_info("sink", "Audio EOF.");
+ // @TODO: This is not well synced. EOF can happen at any time
+ // while other stuff is happening in the sink. For example
+ // while seeking, if EOF happens right after a REMOVE_BUFFERS,
+ // we might assert during RECONNECT because the entry is ended.
+ //
+ // state can be something other than BUFFER_ADDED here
+ // because it could have changed while waiting on the lock above.
if (entry->audio.state == BUFFER_ADDED) {
remove_entry_audio_buffer(sink, entry);
}
// This assert likely doesn't matter due to the handling of the ENDED state.
- al_assert(entry->audio.state == BUFFER_SET_OR_BUFFERED);
+ //al_assert(entry->audio.state == BUFFER_SET_OR_BUFFERED);
entry->audio.state = BUFFER_ENDED;
bool end_entry = VIDEO_ENDED_OR_EMPTY(entry);
#ifndef CAMU_SINK_NO_VIDEO
@@ -847,7 +854,7 @@ static void video_buffer_callback(void *userdata, u8 op)
if (entry->video.state == BUFFER_ADDED) {
remove_entry_video_buffer(sink, entry);
}
- al_assert(entry->video.state == BUFFER_SET_OR_BUFFERED);
+ //al_assert(entry->video.state == BUFFER_SET_OR_BUFFERED);
entry->video.state = BUFFER_ENDED;
if (AUDIO_ENDED_OR_EMPTY(entry)) {
swapped = end_entry_and_advance_queue(sink, entry);