OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 int64_t RemoteEstimatorProxy::TimeUntilNextProcess() { | 64 int64_t RemoteEstimatorProxy::TimeUntilNextProcess() { |
65 int64_t now = clock_->TimeInMilliseconds(); | 65 int64_t now = clock_->TimeInMilliseconds(); |
66 int64_t time_until_next = 0; | 66 int64_t time_until_next = 0; |
67 if (last_process_time_ms_ != -1 && | 67 if (last_process_time_ms_ != -1 && |
68 now - last_process_time_ms_ < kDefaultProcessIntervalMs) { | 68 now - last_process_time_ms_ < kDefaultProcessIntervalMs) { |
69 time_until_next = (last_process_time_ms_ + kDefaultProcessIntervalMs - now); | 69 time_until_next = (last_process_time_ms_ + kDefaultProcessIntervalMs - now); |
70 } | 70 } |
71 return time_until_next; | 71 return time_until_next; |
72 } | 72 } |
73 | 73 |
74 void RemoteEstimatorProxy::Process() { | 74 int32_t RemoteEstimatorProxy::Process() { |
75 if (TimeUntilNextProcess() > 0) | 75 if (TimeUntilNextProcess() > 0) |
76 return; | 76 return 0; |
77 last_process_time_ms_ = clock_->TimeInMilliseconds(); | 77 last_process_time_ms_ = clock_->TimeInMilliseconds(); |
78 | 78 |
79 bool more_to_build = true; | 79 bool more_to_build = true; |
80 while (more_to_build) { | 80 while (more_to_build) { |
81 rtcp::TransportFeedback feedback_packet; | 81 rtcp::TransportFeedback feedback_packet; |
82 if (BuildFeedbackPacket(&feedback_packet)) { | 82 if (BuildFeedbackPacket(&feedback_packet)) { |
83 RTC_DCHECK(packet_router_ != nullptr); | 83 RTC_DCHECK(packet_router_ != nullptr); |
84 packet_router_->SendFeedback(&feedback_packet); | 84 packet_router_->SendFeedback(&feedback_packet); |
85 } else { | 85 } else { |
86 more_to_build = false; | 86 more_to_build = false; |
87 } | 87 } |
88 } | 88 } |
| 89 |
| 90 return 0; |
89 } | 91 } |
90 | 92 |
91 void RemoteEstimatorProxy::OnPacketArrival(uint16_t sequence_number, | 93 void RemoteEstimatorProxy::OnPacketArrival(uint16_t sequence_number, |
92 int64_t arrival_time) { | 94 int64_t arrival_time) { |
93 int64_t seq = unwrapper_.Unwrap(sequence_number); | 95 int64_t seq = unwrapper_.Unwrap(sequence_number); |
94 | 96 |
95 if (window_start_seq_ == -1) { | 97 if (window_start_seq_ == -1) { |
96 window_start_seq_ = seq; | 98 window_start_seq_ = seq; |
97 // Start new feedback packet, cull old packets. | 99 // Start new feedback packet, cull old packets. |
98 for (auto it = packet_arrival_times_.begin(); | 100 for (auto it = packet_arrival_times_.begin(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // they need to be re-sent after a reordering. Removal will be handled | 147 // they need to be re-sent after a reordering. Removal will be handled |
146 // by OnPacketArrival once packets are too old. | 148 // by OnPacketArrival once packets are too old. |
147 } | 149 } |
148 if (it == packet_arrival_times_.end()) | 150 if (it == packet_arrival_times_.end()) |
149 window_start_seq_ = -1; | 151 window_start_seq_ = -1; |
150 | 152 |
151 return true; | 153 return true; |
152 } | 154 } |
153 | 155 |
154 } // namespace webrtc | 156 } // namespace webrtc |
OLD | NEW |