| 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 |
| 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
| 17 #include "webrtc/base/trace_event.h" |
| 17 #include "webrtc/modules/include/module_common_types.h" | 18 #include "webrtc/modules/include/module_common_types.h" |
| 18 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 19 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" |
| 20 | 21 |
| 21 namespace webrtc { | 22 namespace webrtc { |
| 22 namespace rtcp { | 23 namespace rtcp { |
| 23 namespace { | 24 namespace { |
| 24 // Header size: | 25 // Header size: |
| 25 // * 4 bytes Common RTCP Packet Header | 26 // * 4 bytes Common RTCP Packet Header |
| 26 // * 8 bytes Common Packet Format for RTCP Feedback Messages | 27 // * 8 bytes Common Packet Format for RTCP Feedback Messages |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 std::vector<int64_t> us_deltas; | 408 std::vector<int64_t> us_deltas; |
| 408 for (const auto& packet : packets_) | 409 for (const auto& packet : packets_) |
| 409 us_deltas.push_back(packet.delta_us()); | 410 us_deltas.push_back(packet.delta_us()); |
| 410 return us_deltas; | 411 return us_deltas; |
| 411 } | 412 } |
| 412 | 413 |
| 413 // De-serialize packet. | 414 // De-serialize packet. |
| 414 bool TransportFeedback::Parse(const CommonHeader& packet) { | 415 bool TransportFeedback::Parse(const CommonHeader& packet) { |
| 415 RTC_DCHECK_EQ(packet.type(), kPacketType); | 416 RTC_DCHECK_EQ(packet.type(), kPacketType); |
| 416 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); | 417 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); |
| 418 TRACE_EVENT0("webrtc", "TransportFeedback::Parse"); |
| 417 | 419 |
| 418 if (packet.payload_size_bytes() < kMinPayloadSizeBytes) { | 420 if (packet.payload_size_bytes() < kMinPayloadSizeBytes) { |
| 419 LOG(LS_WARNING) << "Buffer too small (" << packet.payload_size_bytes() | 421 LOG(LS_WARNING) << "Buffer too small (" << packet.payload_size_bytes() |
| 420 << " bytes) to fit a " | 422 << " bytes) to fit a " |
| 421 "FeedbackPacket. Minimum size = " | 423 "FeedbackPacket. Minimum size = " |
| 422 << kMinPayloadSizeBytes; | 424 << kMinPayloadSizeBytes; |
| 423 return false; | 425 return false; |
| 424 } | 426 } |
| 425 | 427 |
| 426 const uint8_t* const payload = packet.payload(); | 428 const uint8_t* const payload = packet.payload(); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 665 |
| 664 encoded_chunks_.push_back(last_chunk_->Emit()); | 666 encoded_chunks_.push_back(last_chunk_->Emit()); |
| 665 size_bytes_ += kChunkSizeBytes; | 667 size_bytes_ += kChunkSizeBytes; |
| 666 last_chunk_->Add(delta_size); | 668 last_chunk_->Add(delta_size); |
| 667 ++num_seq_no_; | 669 ++num_seq_no_; |
| 668 return true; | 670 return true; |
| 669 } | 671 } |
| 670 | 672 |
| 671 } // namespace rtcp | 673 } // namespace rtcp |
| 672 } // namespace webrtc | 674 } // namespace webrtc |
| OLD | NEW |