| 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 "base/memory/weak_ptr.h" |
| 10 #include "remoting/codec/webrtc_video_encoder.h" | 10 #include "remoting/codec/webrtc_video_encoder.h" |
| 11 #include "third_party/webrtc/video_encoder.h" | 11 #include "third_party/webrtc/video_encoder.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 namespace protocol { | 14 namespace protocol { |
| 15 | 15 |
| 16 struct HostFrameStats; |
| 16 class VideoChannelStateObserver; | 17 class VideoChannelStateObserver; |
| 17 class WebrtcDummyVideoEncoderFactory; | 18 class WebrtcDummyVideoEncoderFactory; |
| 18 | 19 |
| 19 // An abstract interface for frame schedulers, which are responsible for | 20 // An abstract interface for frame schedulers, which are responsible for |
| 20 // scheduling when video frames are captured and for defining encoding | 21 // scheduling when video frames are captured and for defining encoding |
| 21 // parameters for each frame. | 22 // parameters for each frame. |
| 22 class WebrtcFrameScheduler { | 23 class WebrtcFrameScheduler { |
| 23 public: | 24 public: |
| 24 WebrtcFrameScheduler() {} | 25 WebrtcFrameScheduler() {} |
| 25 virtual ~WebrtcFrameScheduler() {} | 26 virtual ~WebrtcFrameScheduler() {} |
| 26 | 27 |
| 27 // Starts the scheduler. |capture_callback| will be called whenever a new | 28 // Starts the scheduler. |capture_callback| will be called whenever a new |
| 28 // frame should be captured. | 29 // frame should be captured. |
| 29 virtual void Start(WebrtcDummyVideoEncoderFactory* video_encoder_factory, | 30 virtual void Start(WebrtcDummyVideoEncoderFactory* video_encoder_factory, |
| 30 const base::Closure& capture_callback) = 0; | 31 const base::Closure& capture_callback) = 0; |
| 31 | 32 |
| 32 // Pause and resumes the scheduler. | 33 // Pause and resumes the scheduler. |
| 33 virtual void Pause(bool pause) = 0; | 34 virtual void Pause(bool pause) = 0; |
| 34 | 35 |
| 35 // Called after |frame| has been captured to get encoding parameters for the | 36 // Called after |frame| has been captured to get encoding parameters for the |
| 36 // frame. Returns false if the frame should be dropped (e.g. when there are | 37 // frame. Returns false if the frame should be dropped (e.g. when there are |
| 37 // no changed), true otherwise. | 38 // no changed), true otherwise. |
| 38 virtual bool GetEncoderFrameParams( | 39 virtual bool GetEncoderFrameParams( |
| 39 const webrtc::DesktopFrame& frame, | 40 const webrtc::DesktopFrame& frame, |
| 40 WebrtcVideoEncoder::FrameParams* params_out) = 0; | 41 WebrtcVideoEncoder::FrameParams* params_out) = 0; |
| 41 | 42 |
| 42 // Called after a frame has been encoded and passed to the sender. | 43 // Called after a frame has been encoded and passed to the sender. If |
| 44 // |frame_stats| is not null then sets send_pending_delay, rtt_estimate and |
| 45 // bandwidth_estimate_kbps fields. |
| 43 virtual void OnFrameEncoded( | 46 virtual void OnFrameEncoded( |
| 44 const WebrtcVideoEncoder::EncodedFrame& encoded_frame, | 47 const WebrtcVideoEncoder::EncodedFrame& encoded_frame, |
| 45 const webrtc::EncodedImageCallback::Result& send_result) = 0; | 48 const webrtc::EncodedImageCallback::Result& send_result, |
| 49 HostFrameStats* frame_stats) = 0; |
| 46 }; | 50 }; |
| 47 | 51 |
| 48 } // namespace protocol | 52 } // namespace protocol |
| 49 } // namespace remoting | 53 } // namespace remoting |
| 50 | 54 |
| 51 #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ | 55 #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_H_ |
| OLD | NEW |