#include "third_party/blink/public/platform/media/video_frame_compositor.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/bind_post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "media/base/media_switches.h"
#include "media/base/video_frame.h"
#include "third_party/blink/public/platform/web_video_frame_submitter.h"
namespace blink {
RenderingMode;
const int kBackgroundRenderingTimeoutMs = …;
const int kForceBeginFramesTimeoutMs = …;
constexpr const char VideoFrameCompositor::kTracingCategory[];
VideoFrameCompositor::VideoFrameCompositor(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
std::unique_ptr<WebVideoFrameSubmitter> submitter)
: … { … }
cc::UpdateSubmissionStateCB
VideoFrameCompositor::GetUpdateSubmissionStateCallback() { … }
void VideoFrameCompositor::SetIsSurfaceVisible(
bool is_visible,
base::WaitableEvent* done_event) { … }
void VideoFrameCompositor::InitializeSubmitter() { … }
VideoFrameCompositor::~VideoFrameCompositor() { … }
void VideoFrameCompositor::EnableSubmission(
const viz::SurfaceId& id,
media::VideoTransformation transform,
bool force_submit) { … }
bool VideoFrameCompositor::IsClientSinkAvailable() { … }
void VideoFrameCompositor::OnRendererStateUpdate(bool new_state) { … }
void VideoFrameCompositor::SetVideoFrameProviderClient(
cc::VideoFrameProvider::Client* client) { … }
scoped_refptr<media::VideoFrame> VideoFrameCompositor::GetCurrentFrame() { … }
scoped_refptr<media::VideoFrame>
VideoFrameCompositor::GetCurrentFrameOnAnyThread() { … }
void VideoFrameCompositor::SetCurrentFrame_Locked(
scoped_refptr<media::VideoFrame> frame,
base::TimeTicks expected_display_time) { … }
void VideoFrameCompositor::PutCurrentFrame() { … }
bool VideoFrameCompositor::UpdateCurrentFrame(base::TimeTicks deadline_min,
base::TimeTicks deadline_max) { … }
bool VideoFrameCompositor::HasCurrentFrame() { … }
base::TimeDelta VideoFrameCompositor::GetPreferredRenderInterval() { … }
void VideoFrameCompositor::Start(RenderCallback* callback) { … }
void VideoFrameCompositor::Stop() { … }
void VideoFrameCompositor::PaintSingleFrame(
scoped_refptr<media::VideoFrame> frame,
bool repaint_duplicate_frame) { … }
void VideoFrameCompositor::UpdateCurrentFrameIfStale(UpdateType type) { … }
void VideoFrameCompositor::SetOnNewProcessedFrameCallback(
OnNewProcessedFrameCB cb) { … }
void VideoFrameCompositor::SetOnFramePresentedCallback(
OnNewFramePresentedCB present_cb) { … }
void VideoFrameCompositor::StartForceBeginFrames() { … }
void VideoFrameCompositor::StopForceBeginFrames() { … }
std::unique_ptr<WebMediaPlayer::VideoFramePresentationMetadata>
VideoFrameCompositor::GetLastPresentedFrameMetadata() { … }
bool VideoFrameCompositor::ProcessNewFrame(
scoped_refptr<media::VideoFrame> frame,
base::TimeTicks presentation_time,
bool repaint_duplicate_frame) { … }
void VideoFrameCompositor::SetIsPageVisible(bool is_visible) { … }
void VideoFrameCompositor::SetForceSubmit(bool force_submit) { … }
base::TimeDelta VideoFrameCompositor::GetLastIntervalWithoutLock()
NO_THREAD_SAFETY_ANALYSIS { … }
void VideoFrameCompositor::BackgroundRender(RenderingMode mode) { … }
bool VideoFrameCompositor::CallRender(base::TimeTicks deadline_min,
base::TimeTicks deadline_max,
RenderingMode mode) { … }
void VideoFrameCompositor::OnContextLost() { … }
}