From 18a6a1dd1029f7da200680ff3f6b7d8e134ec6a3 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Wed, 9 Nov 2022 06:52:37 -0600 Subject: LibVideo: Handle corrupted video errors without spamming dialogs No longer will the video player explode with error dialogs that then lock the user out of closing them. To avoid issues where the playback state becomes invalid when an error occurs, I've made all decoder errors pass through the frame queue. This way, when a video is corrupted, there should be no chance that the playback state becomes invalid due to setting the state to Corrupted in the event handler while a presentation event is still pending. Or at least I think that was what caused some issues I was seeing :^) This system should be a lot more robust if any future errors need to be handled. --- Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp | 2 +- Userland/Applications/VideoPlayer/VideoPlayerWidget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Userland/Applications/VideoPlayer') diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp index 1145948777..31d5972503 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp @@ -127,7 +127,7 @@ void VideoPlayerWidget::toggle_pause() resume_playback(); } -void VideoPlayerWidget::on_decoding_error(Video::DecoderError error) +void VideoPlayerWidget::on_decoding_error(Video::DecoderError const& error) { StringView text_format; diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h index 738ad06025..e52f5e920c 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h @@ -35,7 +35,7 @@ private: VideoPlayerWidget(GUI::Window&); void update_play_pause_icon(); - void on_decoding_error(Video::DecoderError); + void on_decoding_error(Video::DecoderError const&); void display_next_frame(); void cycle_sizing_modes(); -- cgit v1.2.3