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

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

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 #include "remoting/host/video_frame_pump.h" 5 #include "remoting/host/video_frame_pump.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void VideoFramePump::SendEncodedFrame(int64 latest_event_timestamp, 130 void VideoFramePump::SendEncodedFrame(int64 latest_event_timestamp,
131 base::TimeTicks timestamp, 131 base::TimeTicks timestamp,
132 scoped_ptr<VideoPacket> packet) { 132 scoped_ptr<VideoPacket> packet) {
133 DCHECK(CalledOnValidThread()); 133 DCHECK(CalledOnValidThread());
134 134
135 if (g_enable_timestamps) 135 if (g_enable_timestamps)
136 packet->set_timestamp(timestamp.ToInternalValue()); 136 packet->set_timestamp(timestamp.ToInternalValue());
137 137
138 packet->set_latest_event_timestamp(latest_event_timestamp); 138 packet->set_latest_event_timestamp(latest_event_timestamp);
139 139
140 capture_scheduler_.OnFrameEncoded( 140 capture_scheduler_.OnFrameEncoded(packet.get());
141 base::TimeDelta::FromMilliseconds(packet->encode_time_ms()));
142 141
143 video_stub_->ProcessVideoPacket(packet.Pass(), 142 video_stub_->ProcessVideoPacket(packet.Pass(),
144 base::Bind(&VideoFramePump::OnVideoPacketSent, 143 base::Bind(&VideoFramePump::OnVideoPacketSent,
145 weak_factory_.GetWeakPtr())); 144 weak_factory_.GetWeakPtr()));
146 } 145 }
147 146
148 void VideoFramePump::OnVideoPacketSent() { 147 void VideoFramePump::OnVideoPacketSent() {
149 DCHECK(CalledOnValidThread()); 148 DCHECK(CalledOnValidThread());
150 149
151 capture_scheduler_.OnFrameSent(); 150 capture_scheduler_.OnFrameSent();
152 keep_alive_timer_.Reset(); 151 keep_alive_timer_.Reset();
153 } 152 }
154 153
155 void VideoFramePump::SendKeepAlivePacket() { 154 void VideoFramePump::SendKeepAlivePacket() {
156 DCHECK(CalledOnValidThread()); 155 DCHECK(CalledOnValidThread());
157 156
158 video_stub_->ProcessVideoPacket( 157 video_stub_->ProcessVideoPacket(
159 make_scoped_ptr(new VideoPacket()), 158 make_scoped_ptr(new VideoPacket()),
160 base::Bind(&VideoFramePump::OnKeepAlivePacketSent, 159 base::Bind(&VideoFramePump::OnKeepAlivePacketSent,
161 weak_factory_.GetWeakPtr())); 160 weak_factory_.GetWeakPtr()));
162 } 161 }
163 162
164 void VideoFramePump::OnKeepAlivePacketSent() { 163 void VideoFramePump::OnKeepAlivePacketSent() {
165 DCHECK(CalledOnValidThread()); 164 DCHECK(CalledOnValidThread());
166 165
167 keep_alive_timer_.Reset(); 166 keep_alive_timer_.Reset();
168 } 167 }
169 168
170 } // namespace remoting 169 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698