1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:27:35 +00:00

LibVideo: Deduplicate logic for dispatching video frame queue items

Previously we had dispatch_decoder_error and on_decoder_error serving
the same function, with one not handling the end of stream properly.

There is also a new function to dispatch either an error or a frame to
the owner of this playback manager, so that PlaybackStateHandlers don't
have to duplicate this logic.
This commit is contained in:
Zaggy1024 2023-02-12 00:44:16 -06:00 committed by Andreas Kling
parent e813b8fd19
commit 2a228e8a6e
2 changed files with 28 additions and 20 deletions

View file

@ -106,8 +106,6 @@ public:
u64 number_of_skipped_frames() const { return m_skipped_frames; }
void on_decoder_error(DecoderError error);
Time current_playback_time();
Time duration();
@ -130,6 +128,8 @@ private:
void dispatch_decoder_error(DecoderError error);
void dispatch_new_frame(RefPtr<Gfx::Bitmap> frame);
// Returns whether we changed playback states. If so, any PlaybackStateHandler processing must cease.
[[nodiscard]] bool dispatch_frame_queue_item(FrameQueueItem&&);
void dispatch_fatal_error(Error);
Core::Object& m_event_handler;