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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |