mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 20:42:11 +02:00
`IncrementallyPopulatedStream::Cursor` now tracks whether it's currently blocked inside a wait for more bytes, allowing higher layers to distinguish "no frames yet" from "decoder is idle". Enter buffering when `DisplayingVideoSink` runs out of frames and the associated `VideoDataProvider` is blocked waiting for data to arrive. Exit buffering once decoding refills the frame queue. For now, buffering behaves like paused, but it gives us an explicit state to hook UI into.
40 lines
818 B
C++
40 lines
818 B
C++
/*
|
|
* Copyright (c) 2025, Gregory Bertilson <zaggy1024@gmail.com>
|
|
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibMedia/PlaybackStates/Forward.h>
|
|
#include <LibMedia/PlaybackStates/ResumingStateHandler.h>
|
|
|
|
namespace Media {
|
|
|
|
class BufferingStateHandler final : public ResumingStateHandler {
|
|
public:
|
|
BufferingStateHandler(PlaybackManager& manager, bool playing)
|
|
: ResumingStateHandler(manager, playing)
|
|
{
|
|
}
|
|
|
|
virtual ~BufferingStateHandler() override = default;
|
|
|
|
virtual PlaybackState state() override
|
|
{
|
|
return PlaybackState::Buffering;
|
|
}
|
|
|
|
virtual void enter_buffering() override
|
|
{
|
|
}
|
|
|
|
virtual void exit_buffering() override
|
|
{
|
|
resume();
|
|
}
|
|
};
|
|
|
|
}
|