sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 1 | // 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 Lambrou | c574b8f | 2021-04-19 22:45:50 | [diff] [blame] | 9 | #include "remoting/protocol/video_channel_state_observer.h" |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 10 | |
Lambros Lambrou | ba22449 | 2021-10-28 21:46:24 | [diff] [blame] | 11 | namespace webrtc { |
| 12 | class DesktopFrame; |
| 13 | } // namespace webrtc |
| 14 | |
Joe Downing | 39d710e | 2022-08-25 20:11:45 | [diff] [blame^] | 15 | namespace remoting::protocol { |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 16 | |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 17 | // 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 Lambrou | c574b8f | 2021-04-19 22:45:50 | [diff] [blame] | 20 | class WebrtcFrameScheduler : public VideoChannelStateObserver { |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 21 | public: |
Lambros Lambrou | c574b8f | 2021-04-19 22:45:50 | [diff] [blame] | 22 | WebrtcFrameScheduler() = default; |
| 23 | ~WebrtcFrameScheduler() override = default; |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 24 | |
| 25 | // Starts the scheduler. |capture_callback| will be called whenever a new |
| 26 | // frame should be captured. |
Lambros Lambrou | c574b8f | 2021-04-19 22:45:50 | [diff] [blame] | 27 | virtual void Start(const base::RepeatingClosure& capture_callback) = 0; |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 28 | |
| 29 | // Pause and resumes the scheduler. |
| 30 | virtual void Pause(bool pause) = 0; |
| 31 | |
Joe Downing | 39d710e | 2022-08-25 20:11:45 | [diff] [blame^] | 32 | // Called after |frame| has been captured. |frame| may be set to nullptr if |
| 33 | // the capture request failed. |
Lambros Lambrou | ba22449 | 2021-10-28 21:46:24 | [diff] [blame] | 34 | virtual void OnFrameCaptured(const webrtc::DesktopFrame* frame) = 0; |
Lambros Lambrou | 0fd556ae | 2021-11-09 17:19:49 | [diff] [blame] | 35 | |
Joe Downing | 39d710e | 2022-08-25 20:11:45 | [diff] [blame^] | 36 | // Called when WebRTC requests the VideoTrackSource to provide frames at a |
| 37 | // maximum framerate. |
Lambros Lambrou | 0fd556ae | 2021-11-09 17:19:49 | [diff] [blame] | 38 | virtual void SetMaxFramerateFps(int max_framerate_fps) = 0; |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 39 | }; |
| 40 | |
Joe Downing | 39d710e | 2022-08-25 20:11:45 | [diff] [blame^] | 41 | } // namespace remoting::protocol |
sergeyu | 0eaa513 | 2016-09-20 01:39:34 | [diff] [blame] | 42 | |
| 43 | #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |