mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-25 20:16:14 -05:00
[spotify] Flush audio buffer on playback stop - and since we are
flushing from another thread we use evbuffer_enable_locking() which in turn adds a requirement for libevent_pthreads to be present
This commit is contained in:
@@ -1252,6 +1252,7 @@ playback_stop(void *arg, int *retval)
|
||||
|
||||
g_state = SPOTIFY_STATE_STOPPED;
|
||||
|
||||
evbuffer_drain(spotify_audio_buffer, evbuffer_get_length(spotify_audio_buffer));
|
||||
|
||||
*retval = 0;
|
||||
return COMMAND_END;
|
||||
@@ -1297,7 +1298,6 @@ playback_eot(void *arg, int *retval)
|
||||
g_state = SPOTIFY_STATE_STOPPING;
|
||||
|
||||
// TODO 1) This will block for a while, but perhaps ok?
|
||||
// 2) spotify_audio_buffer not entirely thread safe here (but unlikely risk...)
|
||||
input_write(spotify_audio_buffer, INPUT_FLAG_EOF);
|
||||
|
||||
*retval = 0;
|
||||
@@ -2487,6 +2487,8 @@ spotify_init(void)
|
||||
|
||||
spotify_audio_buffer = evbuffer_new();
|
||||
|
||||
CHECK_ERR(L_SPOTIFY, evbuffer_enable_locking(spotify_audio_buffer, NULL));
|
||||
|
||||
CHECK_ERR(L_SPOTIFY, mutex_init(&login_lck));
|
||||
CHECK_ERR(L_SPOTIFY, pthread_cond_init(&login_cond, NULL));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user