| 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_SIMPLE_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_ |
| 6 #define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_ |
| 7 | 7 |
| 8 #include "remoting/protocol/webrtc_frame_scheduler.h" | 8 #include "remoting/protocol/webrtc_frame_scheduler.h" |
| 9 | 9 |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 void OnChannelParameters(int packet_loss, base::TimeDelta rtt) override; | 31 void OnChannelParameters(int packet_loss, base::TimeDelta rtt) override; |
| 32 void OnTargetBitrateChanged(int bitrate_kbps) override; | 32 void OnTargetBitrateChanged(int bitrate_kbps) override; |
| 33 | 33 |
| 34 // WebrtcFrameScheduler implementation. | 34 // WebrtcFrameScheduler implementation. |
| 35 void Start(WebrtcDummyVideoEncoderFactory* video_encoder_factory, | 35 void Start(WebrtcDummyVideoEncoderFactory* video_encoder_factory, |
| 36 const base::Closure& capture_callback) override; | 36 const base::Closure& capture_callback) override; |
| 37 void Pause(bool pause) override; | 37 void Pause(bool pause) override; |
| 38 bool GetEncoderFrameParams( | 38 bool GetEncoderFrameParams( |
| 39 const webrtc::DesktopFrame& frame, | 39 const webrtc::DesktopFrame& frame, |
| 40 WebrtcVideoEncoder::FrameParams* params_out) override; | 40 WebrtcVideoEncoder::FrameParams* params_out) override; |
| 41 void OnFrameEncoded( | 41 void OnFrameEncoded(const WebrtcVideoEncoder::EncodedFrame& encoded_frame, |
| 42 const WebrtcVideoEncoder::EncodedFrame& encoded_frame, | 42 const webrtc::EncodedImageCallback::Result& send_result, |
| 43 const webrtc::EncodedImageCallback::Result& send_result) override; | 43 HostFrameStats* frame_stats) override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 void ScheduleNextFrame(base::TimeTicks now); | 46 void ScheduleNextFrame(base::TimeTicks now); |
| 47 void CaptureNextFrame(); | 47 void CaptureNextFrame(); |
| 48 | 48 |
| 49 base::Closure capture_callback_; | 49 base::Closure capture_callback_; |
| 50 bool paused_ = false; | 50 bool paused_ = false; |
| 51 bool key_frame_request_ = false; | 51 bool key_frame_request_ = false; |
| 52 | 52 |
| 53 base::TimeTicks last_capture_started_time_; | 53 base::TimeTicks last_capture_started_time_; |
| 54 | 54 |
| 55 LeakyBucket pacing_bucket_; | 55 LeakyBucket pacing_bucket_; |
| 56 | 56 |
| 57 // Set to true when a frame is being captured or encoded. | 57 // Set to true when a frame is being captured or encoded. |
| 58 bool frame_pending_ = false; | 58 bool frame_pending_ = false; |
| 59 | 59 |
| 60 base::TimeDelta rtt_estimate_; |
| 61 |
| 60 // Set to true when encoding unchanged frames for top-off. | 62 // Set to true when encoding unchanged frames for top-off. |
| 61 bool top_off_is_active_ = false; | 63 bool top_off_is_active_ = false; |
| 62 | 64 |
| 63 // Accumulator for capture and encoder delay history. | 65 // Accumulator for capture and encoder delay history. |
| 64 RunningSamples frame_processing_delay_us_; | 66 RunningSamples frame_processing_delay_us_; |
| 65 | 67 |
| 66 // Accumulator for updated region area in the previously encoded frames. | 68 // Accumulator for updated region area in the previously encoded frames. |
| 67 RunningSamples updated_region_area_; | 69 RunningSamples updated_region_area_; |
| 68 | 70 |
| 69 base::OneShotTimer capture_timer_; | 71 base::OneShotTimer capture_timer_; |
| 70 | 72 |
| 71 base::ThreadChecker thread_checker_; | 73 base::ThreadChecker thread_checker_; |
| 72 base::WeakPtrFactory<WebrtcFrameSchedulerSimple> weak_factory_; | 74 base::WeakPtrFactory<WebrtcFrameSchedulerSimple> weak_factory_; |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace protocol | 77 } // namespace protocol |
| 76 } // namespace remoting | 78 } // namespace remoting |
| 77 | 79 |
| 78 #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_ | 80 #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_ |
| OLD | NEW |