diff options
| author | 2025-01-27 21:56:39 -0500 | |
|---|---|---|
| committer | 2025-01-27 21:56:39 -0500 | |
| commit | 457a3cc1a04e45e31370d9083186436b0d12ab1d (patch) | |
| tree | 7ffb9d676edd4a1b88e8f1020dd905efcfe6b83a /src/libsink | |
| parent | f760ecedb619a55ec8ee989639ac385f27e82d98 (diff) | |
| download | camu-457a3cc1a04e45e31370d9083186436b0d12ab1d.tar.gz camu-457a3cc1a04e45e31370d9083186436b0d12ab1d.tar.bz2 camu-457a3cc1a04e45e31370d9083186436b0d12ab1d.zip | |
Refactor threaded waits
- Move seek to handler thread.
- Cleanup and comment some stuff.
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/libsink')
| -rw-r--r-- | src/libsink/sink.c | 11 |
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); |