blob: 39a4ace2c220b25fc8628984ba1b2b97dc0216c6 [file] [log] [blame]
Avi Drissmand6cdf9b2022-09-15 19:52:531// Copyright 2016 The Chromium Authors
sergeyu0eaa5132016-09-20 01:39:342// 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"
sergeyu0eaa5132016-09-20 01:39:349
Lambros Lambrouba224492021-10-28 21:46:2410namespace webrtc {
11class DesktopFrame;
12} // namespace webrtc
13
Joe Downing39d710e2022-08-25 20:11:4514namespace remoting::protocol {
sergeyu0eaa5132016-09-20 01:39:3415
sergeyu0eaa5132016-09-20 01:39:3416// An abstract interface for frame schedulers, which are responsible for
17// scheduling when video frames are captured and for defining encoding
18// parameters for each frame.
Joe Downing87a28e12022-08-29 18:12:0419class WebrtcFrameScheduler {
sergeyu0eaa5132016-09-20 01:39:3420 public:
Lambros Lambrouc574b8f2021-04-19 22:45:5021 WebrtcFrameScheduler() = default;
Joe Downing87a28e12022-08-29 18:12:0422 virtual ~WebrtcFrameScheduler() = default;
sergeyu0eaa5132016-09-20 01:39:3423
24 // Starts the scheduler. |capture_callback| will be called whenever a new
25 // frame should be captured.
Lambros Lambrouc574b8f2021-04-19 22:45:5026 virtual void Start(const base::RepeatingClosure& capture_callback) = 0;
sergeyu0eaa5132016-09-20 01:39:3427
28 // Pause and resumes the scheduler.
29 virtual void Pause(bool pause) = 0;
30
Joe Downing39d710e2022-08-25 20:11:4531 // Called after |frame| has been captured. |frame| may be set to nullptr if
32 // the capture request failed.
Lambros Lambrouba224492021-10-28 21:46:2433 virtual void OnFrameCaptured(const webrtc::DesktopFrame* frame) = 0;
Lambros Lambrou0fd556ae2021-11-09 17:19:4934
Joe Downing39d710e2022-08-25 20:11:4535 // Called when WebRTC requests the VideoTrackSource to provide frames at a
36 // maximum framerate.
Lambros Lambrou0fd556ae2021-11-09 17:19:4937 virtual void SetMaxFramerateFps(int max_framerate_fps) = 0;
sergeyu0eaa5132016-09-20 01:39:3438};
39
Joe Downing39d710e2022-08-25 20:11:4540} // namespace remoting::protocol
sergeyu0eaa5132016-09-20 01:39:3441
42#endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_