fix: preserve playback state across audio settings changes
ReinitDevice was resetting position to 0 and clearing audio data, making it impossible to resume after changing audio settings. Now uses pause_playback_timer() to capture real-time position and keeps audio data intact. The existing Resume handler already recreates the engine, re-decodes, and seeks to the saved position. Removes unnecessary stop_playback calls from frontend that were destroying the preserved state after backend/device changes.
This commit is contained in:
1 parent
aef4285fd9
commit
f2d8408268
2 files changed
+9
-21
No files matched your search
@@ -1615,10 +1615,13 @@ impl Player {
|
||||
log::error!("Audio thread: failed to reinitialize device");
|
||||
}
|
||||
|
||||
// Preserve position so Resume can seek back to it.
|
||||
// pause_playback_timer() captures the real-time position
|
||||
// into thread_state.position before clearing the timer.
|
||||
thread_state.pause_playback_timer();
|
||||
thread_state.is_playing.store(false, Ordering::SeqCst);
|
||||
thread_state.position.store(0, Ordering::SeqCst);
|
||||
thread_state.playback_start_millis.store(0, Ordering::SeqCst);
|
||||
*current_audio_data = None;
|
||||
// Keep current_audio_data and current_streaming_source
|
||||
// intact so Resume can recreate the engine and seek.
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user