[Bugfix] FS#13492 - Playback resume fails after USB insert

On usb plug system_flush() gets called before the other
threads get a chance to ACK the insert

system_flush() calls playlist_shutdown() (amongst other things)
playlist_shutdown closes the control file

the audio thread acks USB insert
audio_stop_playback is called which now can't look up the
filename from the now closed handle for control the control file

I left the guard for checking for USB insert but it appears to be
fine without it

Change-Id: I935dbf7aed38d4a57413c0063ad953f427e9b3bb
This commit is contained in:
William Wilgus 2024-09-26 01:34:56 -04:00
parent e6313e4b8e
commit f55cb77f89

View file

@ -1949,10 +1949,14 @@ void playlist_init(void)
* Clean playlist at shutdown
*/
void playlist_shutdown(void)
{
/*BugFix we need to save resume info first */
/*if (usb_detect() == USB_INSERTED)*/
audio_stop();
struct playlist_info* playlist = &current_playlist;
playlist_write_lock(playlist);
logf("Closing Control %s", __func__);
if (playlist->control_fd >= 0)
pl_close_control(playlist);