OLD | NEW |
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void VideoFramePump::SendEncodedFrame(int64 latest_event_timestamp, | 139 void VideoFramePump::SendEncodedFrame(int64 latest_event_timestamp, |
140 base::TimeTicks timestamp, | 140 base::TimeTicks timestamp, |
141 scoped_ptr<VideoPacket> packet) { | 141 scoped_ptr<VideoPacket> packet) { |
142 DCHECK(thread_checker_.CalledOnValidThread()); | 142 DCHECK(thread_checker_.CalledOnValidThread()); |
143 | 143 |
144 if (g_enable_timestamps) | 144 if (g_enable_timestamps) |
145 packet->set_timestamp(timestamp.ToInternalValue()); | 145 packet->set_timestamp(timestamp.ToInternalValue()); |
146 | 146 |
147 packet->set_latest_event_timestamp(latest_event_timestamp); | 147 packet->set_latest_event_timestamp(latest_event_timestamp); |
148 | 148 |
149 capture_scheduler_.OnFrameEncoded( | 149 capture_scheduler_.OnFrameEncoded(packet.get()); |
150 base::TimeDelta::FromMilliseconds(packet->encode_time_ms())); | |
151 | 150 |
152 video_stub_->ProcessVideoPacket(packet.Pass(), | 151 video_stub_->ProcessVideoPacket(packet.Pass(), |
153 base::Bind(&VideoFramePump::OnVideoPacketSent, | 152 base::Bind(&VideoFramePump::OnVideoPacketSent, |
154 weak_factory_.GetWeakPtr())); | 153 weak_factory_.GetWeakPtr())); |
155 } | 154 } |
156 | 155 |
157 void VideoFramePump::OnVideoPacketSent() { | 156 void VideoFramePump::OnVideoPacketSent() { |
158 DCHECK(thread_checker_.CalledOnValidThread()); | 157 DCHECK(thread_checker_.CalledOnValidThread()); |
159 | 158 |
160 capture_scheduler_.OnFrameSent(); | 159 capture_scheduler_.OnFrameSent(); |
161 keep_alive_timer_.Reset(); | 160 keep_alive_timer_.Reset(); |
162 } | 161 } |
163 | 162 |
164 void VideoFramePump::SendKeepAlivePacket() { | 163 void VideoFramePump::SendKeepAlivePacket() { |
165 DCHECK(thread_checker_.CalledOnValidThread()); | 164 DCHECK(thread_checker_.CalledOnValidThread()); |
166 | 165 |
167 video_stub_->ProcessVideoPacket( | 166 video_stub_->ProcessVideoPacket( |
168 make_scoped_ptr(new VideoPacket()), | 167 make_scoped_ptr(new VideoPacket()), |
169 base::Bind(&VideoFramePump::OnKeepAlivePacketSent, | 168 base::Bind(&VideoFramePump::OnKeepAlivePacketSent, |
170 weak_factory_.GetWeakPtr())); | 169 weak_factory_.GetWeakPtr())); |
171 } | 170 } |
172 | 171 |
173 void VideoFramePump::OnKeepAlivePacketSent() { | 172 void VideoFramePump::OnKeepAlivePacketSent() { |
174 DCHECK(thread_checker_.CalledOnValidThread()); | 173 DCHECK(thread_checker_.CalledOnValidThread()); |
175 | 174 |
176 keep_alive_timer_.Reset(); | 175 keep_alive_timer_.Reset(); |
177 } | 176 } |
178 | 177 |
179 } // namespace remoting | 178 } // namespace remoting |
OLD | NEW |