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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 369 |
370 const std::vector<TransportFeedback::ReceivedPacket>& | 370 const std::vector<TransportFeedback::ReceivedPacket>& |
371 TransportFeedback::GetReceivedPackets() const { | 371 TransportFeedback::GetReceivedPackets() const { |
372 return packets_; | 372 return packets_; |
373 } | 373 } |
374 | 374 |
375 uint16_t TransportFeedback::GetBaseSequence() const { | 375 uint16_t TransportFeedback::GetBaseSequence() const { |
376 return base_seq_no_; | 376 return base_seq_no_; |
377 } | 377 } |
378 | 378 |
379 std::vector<TransportFeedback::StatusSymbol> | |
380 TransportFeedback::GetStatusVector() const { | |
381 std::vector<TransportFeedback::StatusSymbol> symbols; | |
382 uint16_t seq_no = GetBaseSequence(); | |
383 for (const auto& packet : packets_) { | |
384 for (; seq_no != packet.sequence_number(); ++seq_no) | |
385 symbols.push_back(StatusSymbol::kNotReceived); | |
386 if (packet.delta_ticks() >= 0x00 && packet.delta_ticks() <= 0xff) { | |
387 symbols.push_back(StatusSymbol::kReceivedSmallDelta); | |
388 } else { | |
389 symbols.push_back(StatusSymbol::kReceivedLargeDelta); | |
390 } | |
391 ++seq_no; | |
392 } | |
393 return symbols; | |
394 } | |
395 | |
396 std::vector<int16_t> TransportFeedback::GetReceiveDeltas() const { | |
397 std::vector<int16_t> deltas; | |
398 for (const auto& packet : packets_) | |
399 deltas.push_back(packet.delta_ticks()); | |
400 return deltas; | |
401 } | |
402 | |
403 int64_t TransportFeedback::GetBaseTimeUs() const { | 379 int64_t TransportFeedback::GetBaseTimeUs() const { |
404 return static_cast<int64_t>(base_time_ticks_) * kBaseScaleFactor; | 380 return static_cast<int64_t>(base_time_ticks_) * kBaseScaleFactor; |
405 } | 381 } |
406 | 382 |
407 std::vector<int64_t> TransportFeedback::GetReceiveDeltasUs() const { | |
408 std::vector<int64_t> us_deltas; | |
409 for (const auto& packet : packets_) | |
410 us_deltas.push_back(packet.delta_us()); | |
411 return us_deltas; | |
412 } | |
413 | |
414 // De-serialize packet. | 383 // De-serialize packet. |
415 bool TransportFeedback::Parse(const CommonHeader& packet) { | 384 bool TransportFeedback::Parse(const CommonHeader& packet) { |
416 RTC_DCHECK_EQ(packet.type(), kPacketType); | 385 RTC_DCHECK_EQ(packet.type(), kPacketType); |
417 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); | 386 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); |
418 TRACE_EVENT0("webrtc", "TransportFeedback::Parse"); | 387 TRACE_EVENT0("webrtc", "TransportFeedback::Parse"); |
419 | 388 |
420 if (packet.payload_size_bytes() < kMinPayloadSizeBytes) { | 389 if (packet.payload_size_bytes() < kMinPayloadSizeBytes) { |
421 LOG(LS_WARNING) << "Buffer too small (" << packet.payload_size_bytes() | 390 LOG(LS_WARNING) << "Buffer too small (" << packet.payload_size_bytes() |
422 << " bytes) to fit a " | 391 << " bytes) to fit a " |
423 "FeedbackPacket. Minimum size = " | 392 "FeedbackPacket. Minimum size = " |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 634 |
666 encoded_chunks_.push_back(last_chunk_->Emit()); | 635 encoded_chunks_.push_back(last_chunk_->Emit()); |
667 size_bytes_ += kChunkSizeBytes; | 636 size_bytes_ += kChunkSizeBytes; |
668 last_chunk_->Add(delta_size); | 637 last_chunk_->Add(delta_size); |
669 ++num_seq_no_; | 638 ++num_seq_no_; |
670 return true; | 639 return true; |
671 } | 640 } |
672 | 641 |
673 } // namespace rtcp | 642 } // namespace rtcp |
674 } // namespace webrtc | 643 } // namespace webrtc |
OLD | NEW |