blob: 7d3a8f3b79c131917f7aa4102e3d028557f953d3 [file] [log] [blame]
sergeyu0eaa5132016-09-20 01:39:341// Copyright 2016 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_
6#define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_
7
8#include "base/callback_forward.h"
Lambros Lambrouc574b8f2021-04-19 22:45:509#include "remoting/protocol/video_channel_state_observer.h"
sergeyu0eaa5132016-09-20 01:39:3410
Lambros Lambrouba224492021-10-28 21:46:2411namespace webrtc {
12class DesktopFrame;
13} // namespace webrtc
14
Joe Downing39d710e2022-08-25 20:11:4515namespace remoting::protocol {
sergeyu0eaa5132016-09-20 01:39:3416
sergeyu0eaa5132016-09-20 01:39:3417// An abstract interface for frame schedulers, which are responsible for
18// scheduling when video frames are captured and for defining encoding
19// parameters for each frame.
Lambros Lambrouc574b8f2021-04-19 22:45:5020class WebrtcFrameScheduler : public VideoChannelStateObserver {
sergeyu0eaa5132016-09-20 01:39:3421 public:
Lambros Lambrouc574b8f2021-04-19 22:45:5022 WebrtcFrameScheduler() = default;
23 ~WebrtcFrameScheduler() override = default;
sergeyu0eaa5132016-09-20 01:39:3424
25 // Starts the scheduler. |capture_callback| will be called whenever a new
26 // frame should be captured.
Lambros Lambrouc574b8f2021-04-19 22:45:5027 virtual void Start(const base::RepeatingClosure& capture_callback) = 0;
sergeyu0eaa5132016-09-20 01:39:3428
29 // Pause and resumes the scheduler.
30 virtual void Pause(bool pause) = 0;
31
Joe Downing39d710e2022-08-25 20:11:4532 // Called after |frame| has been captured. |frame| may be set to nullptr if
33 // the capture request failed.
Lambros Lambrouba224492021-10-28 21:46:2434 virtual void OnFrameCaptured(const webrtc::DesktopFrame* frame) = 0;
Lambros Lambrou0fd556ae2021-11-09 17:19:4935
Joe Downing39d710e2022-08-25 20:11:4536 // Called when WebRTC requests the VideoTrackSource to provide frames at a
37 // maximum framerate.
Lambros Lambrou0fd556ae2021-11-09 17:19:4938 virtual void SetMaxFramerateFps(int max_framerate_fps) = 0;
sergeyu0eaa5132016-09-20 01:39:3439};
40
Joe Downing39d710e2022-08-25 20:11:4541} // namespace remoting::protocol
sergeyu0eaa5132016-09-20 01:39:3442
43#endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_