fix(player): clear streaming loaded state on streaming setup failures

Buffer timeout, engine creation failure, and incremental source failure
no longer leave has_loaded_audio true with no engine; each records a
user-visible stream error.
This commit is contained in:
Afonso Jorge Ramos committed 2026-07-13 13:49:34 +02:00
1 parent a9949b8cf2
commit 542ee8050f
1 file changed
+23
+23
View File
@@ -2288,6 +2288,15 @@ impl Player {
"Failed to create engine for streaming: {}",
e
);
*current_streaming_source = None;
*current_audio_data = None;
thread_state.set_loaded_audio(false);
thread_state
.is_playing
.store(false, Ordering::SeqCst);
thread_state.record_stream_error(
"Failed to create the playback engine for streaming",
);
return;
}
}
@@ -2356,6 +2365,13 @@ impl Player {
if !source.has_min_buffer() {
log::error!("Streaming: timeout waiting for initial buffer");
*current_streaming_source = None;
*current_audio_data = None;
thread_state.set_loaded_audio(false);
thread_state.is_playing.store(false, Ordering::SeqCst);
thread_state.record_stream_error(
"Timed out waiting for the stream buffer to fill",
);
return;
}
if resume_buffer_target > 0
@@ -2384,6 +2400,13 @@ impl Player {
"Failed to create incremental streaming source: {}",
e
);
*current_streaming_source = None;
*current_audio_data = None;
thread_state.set_loaded_audio(false);
thread_state.is_playing.store(false, Ordering::SeqCst);
thread_state.record_stream_error(
"Failed to start the streaming decoder",
);
return;
}
};