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