| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/protocol/rtp_video_reader.h" | 5 #include "remoting/protocol/rtp_video_reader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/task.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
| 10 #include "remoting/proto/video.pb.h" | 10 #include "remoting/proto/video.pb.h" |
| 11 #include "remoting/protocol/session.h" | 11 #include "remoting/protocol/session.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 namespace protocol { | 14 namespace protocol { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 const int kMaxPacketsInQueue = 1024; | 17 const int kMaxPacketsInQueue = 1024; |
| 18 const int kReceiverReportsIntervalMs = 1000; | 18 const int kReceiverReportsIntervalMs = 1000; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 | 210 |
| 211 packet->mutable_data()->resize(content.total_bytes()); | 211 packet->mutable_data()->resize(content.total_bytes()); |
| 212 content.CopyTo(const_cast<char*>(packet->mutable_data()->data()), | 212 content.CopyTo(const_cast<char*>(packet->mutable_data()->data()), |
| 213 packet->data().size()); | 213 packet->data().size()); |
| 214 | 214 |
| 215 // Set format. | 215 // Set format. |
| 216 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); | 216 packet->mutable_format()->set_encoding(VideoPacketFormat::ENCODING_VP8); |
| 217 | 217 |
| 218 video_stub_->ProcessVideoPacket( | 218 video_stub_->ProcessVideoPacket( |
| 219 packet, base::Bind(&DeletePointer<VideoPacket>, packet)); | 219 packet, base::Bind(&base::DeletePointer<VideoPacket>, packet)); |
| 220 | 220 |
| 221 SendReceiverReportIf(); | 221 SendReceiverReportIf(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void RtpVideoReader::SendReceiverReportIf() { | 224 void RtpVideoReader::SendReceiverReportIf() { |
| 225 base::Time now = base::Time::Now(); | 225 base::Time now = base::Time::Now(); |
| 226 | 226 |
| 227 // Send receiver report only if we haven't sent any bofore, or | 227 // Send receiver report only if we haven't sent any bofore, or |
| 228 // enough time has passed since the last report. | 228 // enough time has passed since the last report. |
| 229 if (last_receiver_report_.is_null() || | 229 if (last_receiver_report_.is_null() || |
| 230 (now - last_receiver_report_).InMilliseconds() > | 230 (now - last_receiver_report_).InMilliseconds() > |
| 231 kReceiverReportsIntervalMs) { | 231 kReceiverReportsIntervalMs) { |
| 232 RtcpReceiverReport report; | 232 RtcpReceiverReport report; |
| 233 rtp_reader_.GetReceiverReport(&report); | 233 rtp_reader_.GetReceiverReport(&report); |
| 234 rtcp_writer_.SendReport(report); | 234 rtcp_writer_.SendReport(report); |
| 235 | 235 |
| 236 last_receiver_report_ = now; | 236 last_receiver_report_ = now; |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace protocol | 240 } // namespace protocol |
| 241 } // namespace remoting | 241 } // namespace remoting |
| OLD | NEW |