OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |
6 #define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/memory/weak_ptr.h" |
9 #include "remoting/codec/webrtc_video_encoder.h" | 10 #include "remoting/codec/webrtc_video_encoder.h" |
10 #include "third_party/webrtc/video_encoder.h" | 11 #include "third_party/webrtc/video_encoder.h" |
11 | 12 |
12 namespace remoting { | 13 namespace remoting { |
13 namespace protocol { | 14 namespace protocol { |
14 | 15 |
| 16 class VideoChannelStateObserver; |
| 17 class WebrtcDummyVideoEncoderFactory; |
| 18 |
15 // An abstract interface for frame schedulers, which are responsible for | 19 // An abstract interface for frame schedulers, which are responsible for |
16 // scheduling when video frames are captured and for defining encoding | 20 // scheduling when video frames are captured and for defining encoding |
17 // parameters for each frame. | 21 // parameters for each frame. |
18 class WebrtcFrameScheduler { | 22 class WebrtcFrameScheduler { |
19 public: | 23 public: |
20 WebrtcFrameScheduler() {} | 24 WebrtcFrameScheduler() {} |
21 virtual ~WebrtcFrameScheduler() {} | 25 virtual ~WebrtcFrameScheduler() {} |
22 | 26 |
23 // Starts the scheduler. |capture_callback| will be called whenever a new | 27 // Starts the scheduler. |capture_callback| will be called whenever a new |
24 // frame should be captured. | 28 // frame should be captured. |
25 virtual void Start(const base::Closure& capture_callback) = 0; | 29 virtual void Start(WebrtcDummyVideoEncoderFactory* video_encoder_factory, |
| 30 const base::Closure& capture_callback) = 0; |
26 | 31 |
27 // Pause and resumes the scheduler. | 32 // Pause and resumes the scheduler. |
28 virtual void Pause(bool pause) = 0; | 33 virtual void Pause(bool pause) = 0; |
29 | 34 |
30 // Requests a key frame. | |
31 virtual void SetKeyFrameRequest() = 0; | |
32 | |
33 // Sets network bitrate estimate. | |
34 virtual void SetTargetBitrate(int bitrate_kbps) = 0; | |
35 | |
36 // Called after |frame| has been captured to get encoding parameters for the | 35 // Called after |frame| has been captured to get encoding parameters for the |
37 // frame. Returns false if the frame should be dropped (e.g. when there are | 36 // frame. Returns false if the frame should be dropped (e.g. when there are |
38 // no changed), true otherwise. | 37 // no changed), true otherwise. |
39 virtual bool GetEncoderFrameParams( | 38 virtual bool GetEncoderFrameParams( |
40 const webrtc::DesktopFrame& frame, | 39 const webrtc::DesktopFrame& frame, |
41 WebrtcVideoEncoder::FrameParams* params_out) = 0; | 40 WebrtcVideoEncoder::FrameParams* params_out) = 0; |
42 | 41 |
43 // Called after a frame has been encoded and passed to the sender. | 42 // Called after a frame has been encoded and passed to the sender. |
44 virtual void OnFrameEncoded( | 43 virtual void OnFrameEncoded( |
45 const WebrtcVideoEncoder::EncodedFrame& encoded_frame, | 44 const WebrtcVideoEncoder::EncodedFrame& encoded_frame, |
46 const webrtc::EncodedImageCallback::Result& send_result) = 0; | 45 const webrtc::EncodedImageCallback::Result& send_result) = 0; |
47 }; | 46 }; |
48 | 47 |
49 } // namespace protocol | 48 } // namespace protocol |
50 } // namespace remoting | 49 } // namespace remoting |
51 | 50 |
52 #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ | 51 #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |
OLD | NEW |