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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 static_cast<uint16_t>(last_seq_))) { | 297 static_cast<uint16_t>(last_seq_))) { |
298 if (delta < 0) | 298 if (delta < 0) |
299 delta += (1 << 16); | 299 delta += (1 << 16); |
300 } else if (delta > 0) { | 300 } else if (delta > 0) { |
301 delta -= (1 << 16); | 301 delta -= (1 << 16); |
302 } | 302 } |
303 | 303 |
304 return last_seq_ + delta; | 304 return last_seq_ + delta; |
305 } | 305 } |
306 | 306 |
307 void TransportFeedback::SetBase(uint16_t base_sequence, | 307 void TransportFeedback::WithBase(uint16_t base_sequence, |
308 int64_t ref_timestamp_us) { | 308 int64_t ref_timestamp_us) { |
309 RTC_DCHECK_EQ(-1, base_seq_); | 309 RTC_DCHECK_EQ(-1, base_seq_); |
310 RTC_DCHECK_NE(-1, ref_timestamp_us); | 310 RTC_DCHECK_NE(-1, ref_timestamp_us); |
311 base_seq_ = base_sequence; | 311 base_seq_ = base_sequence; |
312 // last_seq_ is the sequence number of the last packed added _before_ a call | 312 // last_seq_ is the sequence number of the last packed added _before_ a call |
313 // to WithReceivedPacket(). Since the first sequence to be added is | 313 // to WithReceivedPacket(). Since the first sequence to be added is |
314 // base_sequence, we need this to be one lower in order for potential missing | 314 // base_sequence, we need this to be one lower in order for potential missing |
315 // packets to be populated properly. | 315 // packets to be populated properly. |
316 last_seq_ = base_sequence - 1; | 316 last_seq_ = base_sequence - 1; |
317 base_time_ = ref_timestamp_us / kBaseScaleFactor; | 317 base_time_ = ref_timestamp_us / kBaseScaleFactor; |
318 last_timestamp_ = base_time_ * kBaseScaleFactor; | 318 last_timestamp_ = base_time_ * kBaseScaleFactor; |
319 } | 319 } |
320 | 320 |
321 void TransportFeedback::SetFeedbackSequenceNumber(uint8_t feedback_sequence) { | 321 void TransportFeedback::WithFeedbackSequenceNumber(uint8_t feedback_sequence) { |
322 feedback_seq_ = feedback_sequence; | 322 feedback_seq_ = feedback_sequence; |
323 } | 323 } |
324 | 324 |
325 bool TransportFeedback::AddReceivedPacket(uint16_t sequence_number, | 325 bool TransportFeedback::WithReceivedPacket(uint16_t sequence_number, |
326 int64_t timestamp) { | 326 int64_t timestamp) { |
327 RTC_DCHECK_NE(-1, base_seq_); | 327 RTC_DCHECK_NE(-1, base_seq_); |
328 int64_t seq = Unwrap(sequence_number); | 328 int64_t seq = Unwrap(sequence_number); |
329 if (seq != base_seq_ && seq <= last_seq_) | 329 if (seq != base_seq_ && seq <= last_seq_) |
330 return false; | 330 return false; |
331 | 331 |
332 // Convert to ticks and round. | 332 // Convert to ticks and round. |
333 int64_t delta_full = timestamp - last_timestamp_; | 333 int64_t delta_full = timestamp - last_timestamp_; |
334 delta_full += | 334 delta_full += |
335 delta_full < 0 ? -(kDeltaScaleFactor / 2) : kDeltaScaleFactor / 2; | 335 delta_full < 0 ? -(kDeltaScaleFactor / 2) : kDeltaScaleFactor / 2; |
336 delta_full /= kDeltaScaleFactor; | 336 delta_full /= kDeltaScaleFactor; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 "RLE block of size " << rle_chunk->NumSymbols() | 762 "RLE block of size " << rle_chunk->NumSymbols() |
763 << " but only " << max_size << " left to read."; | 763 << " but only " << max_size << " left to read."; |
764 delete rle_chunk; | 764 delete rle_chunk; |
765 return nullptr; | 765 return nullptr; |
766 } | 766 } |
767 return rle_chunk; | 767 return rle_chunk; |
768 } | 768 } |
769 | 769 |
770 } // namespace rtcp | 770 } // namespace rtcp |
771 } // namespace webrtc | 771 } // namespace webrtc |
OLD | NEW |