diff options
author | Zaggy1024 <zaggy1024@gmail.com> | 2023-04-11 20:03:57 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-12 07:55:12 +0200 |
commit | 969c98778737535a48fcbb21d38b614e16d8e4b0 (patch) | |
tree | fd27754091d3f055b03b7a4d8692fb61ba2ad760 /Userland | |
parent | 5abffc9c5a462fe7ed7d8d2da4d3367b346eaf9d (diff) | |
download | serenity-969c98778737535a48fcbb21d38b614e16d8e4b0.zip |
LibVideo: Don't shadow `m_playing` in ResumingStateHandler classes
StartingStateHandler and SeekingStateHandler were declaring their own
`bool m_playing` fields (from previous code where there was no base
class).
In the case of SeekingStateHandler, this only made the logging wrong.
For StartingStateHandler, however, this meant that it was not using
the boolean passed as a parameter to the constructor to define the
state that would be transitioned to after the Starting state finished.
This meant that when the Stopping state replaced itself with the
Starting state, playback would not resume when Starting state exits.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibVideo/PlaybackManager.cpp | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/Userland/Libraries/LibVideo/PlaybackManager.cpp b/Userland/Libraries/LibVideo/PlaybackManager.cpp index bda97295b7..bdba237d64 100644 --- a/Userland/Libraries/LibVideo/PlaybackManager.cpp +++ b/Userland/Libraries/LibVideo/PlaybackManager.cpp @@ -388,24 +388,8 @@ class PlaybackManager::StartingStateHandler : public PlaybackManager::ResumingSt manager().m_next_frame.emplace(manager().m_frame_queue->dequeue()); manager().m_decode_timer->start(0); dbgln_if(PLAYBACK_MANAGER_DEBUG, "Displayed frame at {}ms, emplaced second frame at {}ms, finishing start now", manager().m_last_present_in_media_time.to_milliseconds(), manager().m_next_frame->timestamp().to_milliseconds()); - if (!m_playing) - return replace_handler_and_delete_this<PausedStateHandler>(); - return replace_handler_and_delete_this<PlayingStateHandler>(); - } - - ErrorOr<void> play() override - { - m_playing = true; - return {}; - } - bool is_playing() override { return m_playing; }; - ErrorOr<void> pause() override - { - m_playing = false; - return {}; + return assume_next_state(); } - - bool m_playing { false }; }; class PlaybackManager::PlayingStateHandler : public PlaybackManager::PlaybackStateHandler { @@ -661,7 +645,6 @@ private: return skip_samples_until_timestamp(); } - bool m_playing { false }; Time m_target_timestamp { Time::zero() }; SeekMode m_seek_mode { SeekMode::Accurate }; }; |