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

Side by Side Diff: remoting/host/video_frame_pump.h

Issue 850983002: Implement video frame acknowledgements in the chromoting protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_HOST_VIDEO_FRAME_PUMP_H_ 5 #ifndef REMOTING_HOST_VIDEO_FRAME_PUMP_H_
6 #define REMOTING_HOST_VIDEO_FRAME_PUMP_H_ 6 #define REMOTING_HOST_VIDEO_FRAME_PUMP_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/non_thread_safe.h" 11 #include "base/threading/non_thread_safe.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "remoting/codec/video_encoder.h" 14 #include "remoting/codec/video_encoder.h"
15 #include "remoting/host/capture_scheduler.h" 15 #include "remoting/host/capture_scheduler.h"
16 #include "remoting/proto/video.pb.h" 16 #include "remoting/proto/video.pb.h"
17 17
18 namespace base { 18 namespace base {
19 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
20 } // namespace base 20 } // namespace base
21 21
22 namespace remoting { 22 namespace remoting {
23 23
24 class ScreenCapturerProxy; 24 class ScreenCapturerProxy;
25 25
26 namespace protocol { 26 namespace protocol {
27 class VideoFeedbackStub;
27 class VideoStub; 28 class VideoStub;
28 } // namespace protocol 29 } // namespace protocol
29 30
30 // Class responsible for scheduling frame captures from a screen capturer., 31 // Class responsible for scheduling frame captures from a screen capturer.,
31 // delivering them to a VideoEncoder to encode, and 32 // delivering them to a VideoEncoder to encode, and
32 // finally passing the encoded video packets to the specified VideoStub to send 33 // finally passing the encoded video packets to the specified VideoStub to send
33 // on the network. 34 // on the network.
34 // 35 //
35 // THREADING 36 // THREADING
36 // 37 //
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 86
86 // Updates event timestamp from the last event received from the client. This 87 // Updates event timestamp from the last event received from the client. This
87 // value is sent back to the client for roundtrip latency estimates. 88 // value is sent back to the client for roundtrip latency estimates.
88 void SetLatestEventTimestamp(int64 latest_event_timestamp); 89 void SetLatestEventTimestamp(int64 latest_event_timestamp);
89 90
90 // Sets whether the video encoder should be requested to encode losslessly, 91 // Sets whether the video encoder should be requested to encode losslessly,
91 // or to use a lossless color space (typically requiring higher bandwidth). 92 // or to use a lossless color space (typically requiring higher bandwidth).
92 void SetLosslessEncode(bool want_lossless); 93 void SetLosslessEncode(bool want_lossless);
93 void SetLosslessColor(bool want_lossless); 94 void SetLosslessColor(bool want_lossless);
94 95
96 protocol::VideoFeedbackStub* video_feedback_stub() {
97 return &capture_scheduler_;
98 }
99
95 private: 100 private:
96 // Encodes and sends |frame|. 101 // Encodes and sends |frame|.
97 void EncodeAndSendFrame(scoped_ptr<webrtc::DesktopFrame> frame); 102 void EncodeAndSendFrame(scoped_ptr<webrtc::DesktopFrame> frame);
98 103
99 // Sends encoded frame 104 // Sends encoded frame
100 void SendEncodedFrame(int64 latest_event_timestamp, 105 void SendEncodedFrame(int64 latest_event_timestamp,
101 base::TimeTicks timestamp, 106 base::TimeTicks timestamp,
102 scoped_ptr<VideoPacket> packet); 107 scoped_ptr<VideoPacket> packet);
103 108
104 // Callback passed to |video_stub_| for the last packet in each frame, to 109 // Callback passed to |video_stub_|.
105 // rate-limit frame captures to network throughput.
106 void OnVideoPacketSent(); 110 void OnVideoPacketSent();
107 111
108 // Called by |keep_alive_timer_|. 112 // Called by |keep_alive_timer_|.
109 void SendKeepAlivePacket(); 113 void SendKeepAlivePacket();
110 114
111 // Callback for |video_stub_| called after a keep-alive packet is sent. 115 // Callback for |video_stub_| called after a keep-alive packet is sent.
112 void OnKeepAlivePacketSent(); 116 void OnKeepAlivePacketSent();
113 117
114 // Task runners used to run |encoder_|. 118 // Task runners used to run |encoder_|.
115 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_; 119 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner_;
(...skipping 16 matching lines...) Expand all
132 int64 latest_event_timestamp_; 136 int64 latest_event_timestamp_;
133 137
134 base::WeakPtrFactory<VideoFramePump> weak_factory_; 138 base::WeakPtrFactory<VideoFramePump> weak_factory_;
135 139
136 DISALLOW_COPY_AND_ASSIGN(VideoFramePump); 140 DISALLOW_COPY_AND_ASSIGN(VideoFramePump);
137 }; 141 };
138 142
139 } // namespace remoting 143 } // namespace remoting
140 144
141 #endif // REMOTING_HOST_VIDEO_FRAME_PUMP_H_ 145 #endif // REMOTING_HOST_VIDEO_FRAME_PUMP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698