ladybird/Libraries/LibMedia/PlaybackStates/ResumingStateHandler.cpp
Zaggy1024 2153535057 LibMedia: Implement suspension at the decoded data providers
Instead of using a playback state to initiate and wake from suspension,
suspend the decoders themselves based on the time since the last status
check or pull. This allows audio and video to suspend independently,
and fixes videos getting stuck after suspension due to the waking seeks
being skipped downstream of the decoder, leaving the decoder suspended.
2026-05-22 09:30:10 -05:00

23 lines
525 B
C++

/*
* Copyright (c) 2025-2026, Gregory Bertilson <gregory@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "ResumingStateHandler.h"
#include <LibMedia/PlaybackManager.h>
#include <LibMedia/PlaybackStates/PausedStateHandler.h>
#include <LibMedia/PlaybackStates/PlayingStateHandler.h>
namespace Media {
void ResumingStateHandler::resume()
{
if (m_playing)
manager().replace_state_handler<PlayingStateHandler>();
else
manager().replace_state_handler<PausedStateHandler>();
}
}