Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: remoting/protocol/webrtc_frame_scheduler_simple.h

Issue 2335923002: Add WebrtcCaptureScheduler interface. (Closed)
Patch Set: include <algorithm> Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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_SIMPLE_H_
6 #define REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_
7
8 #include "remoting/protocol/webrtc_frame_scheduler.h"
9
10 #include "base/timer/timer.h"
11
12 namespace remoting {
13 namespace protocol {
14
15 // WebrtcFrameSchedulerSimple is a simple implementation of
16 // WebrtcFrameScheduler that always keeps only one frame in the pipeline.
17 // It schedules each frame after the previous one is expected to finish sending.
18 class WebrtcFrameSchedulerSimple : public WebrtcFrameScheduler {
19 public:
20 WebrtcFrameSchedulerSimple();
21 ~WebrtcFrameSchedulerSimple() override;
22
23 // WebrtcFrameScheduler implementation.
24 void Start(const base::Closure& capture_callback) override;
25 void Pause(bool pause) override;
26 void SetKeyFrameRequest() override;
27 void SetTargetBitrate(int bitrate_kbps) override;
28 bool GetEncoderFrameParams(
29 const webrtc::DesktopFrame& frame,
30 WebrtcVideoEncoder::FrameParams* params_out) override;
31 void OnFrameEncoded(
32 const WebrtcVideoEncoder::EncodedFrame& encoded_frame,
33 const webrtc::EncodedImageCallback::Result& send_result) override;
34
35 private:
36 void ScheduleNextFrame();
37 void CaptureNextFrame();
38
39 base::Closure capture_callback_;
40 bool paused_ = false;
41 bool key_frame_request_ = false;
42 uint32_t target_bitrate_kbps_ = 1000; // Initial bitrate.
43
44 base::TimeTicks last_capture_started_time_;
45 base::TimeTicks last_frame_send_finish_time_;
46
47 // Set to true when encoding unchanged frames for top-off.
48 bool top_off_is_active_ = false;
49
50 base::OneShotTimer capture_timer_;
51 };
52
53 } // namespace protocol
54 } // namespace remoting
55
56 #endif // REMOTING_PROTOCOL_WEBRTC_FRAME_SCHEDULER_SIMPLE_H_
OLDNEW
« no previous file with comments | « remoting/protocol/webrtc_frame_scheduler.h ('k') | remoting/protocol/webrtc_frame_scheduler_simple.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698