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