| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 "RTCPSender::NACK", "nacks", | 878 "RTCPSender::NACK", "nacks", |
| 879 TRACE_STR_COPY(stringBuilder.GetResult().c_str())); | 879 TRACE_STR_COPY(stringBuilder.GetResult().c_str())); |
| 880 ++packet_type_counter_.nack_packets; | 880 ++packet_type_counter_.nack_packets; |
| 881 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_NACKCount", | 881 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_NACKCount", |
| 882 ssrc_, packet_type_counter_.nack_packets); | 882 ssrc_, packet_type_counter_.nack_packets); |
| 883 | 883 |
| 884 return BuildResult::kSuccess; | 884 return BuildResult::kSuccess; |
| 885 } | 885 } |
| 886 | 886 |
| 887 RTCPSender::BuildResult RTCPSender::BuildBYE(RtcpContext* ctx) { | 887 RTCPSender::BuildResult RTCPSender::BuildBYE(RtcpContext* ctx) { |
| 888 // sanity | 888 rtcp::Bye bye; |
| 889 if (ctx->position + 8 >= IP_PACKET_SIZE) | 889 bye.From(ssrc_); |
| 890 for (uint32_t csrc : csrcs_) |
| 891 bye.WithCsrc(csrc); |
| 892 |
| 893 PacketBuiltCallback callback(ctx); |
| 894 if (!callback.BuildPacket(bye)) |
| 890 return BuildResult::kTruncated; | 895 return BuildResult::kTruncated; |
| 891 | 896 |
| 892 // Add a bye packet | |
| 893 // Number of SSRC + CSRCs. | |
| 894 *ctx->AllocateData(1) = static_cast<uint8_t>(0x80 + 1 + csrcs_.size()); | |
| 895 *ctx->AllocateData(1) = 203; | |
| 896 | |
| 897 // length | |
| 898 *ctx->AllocateData(1) = 0; | |
| 899 *ctx->AllocateData(1) = static_cast<uint8_t>(1 + csrcs_.size()); | |
| 900 | |
| 901 // Add our own SSRC | |
| 902 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_); | |
| 903 | |
| 904 // add CSRCs | |
| 905 for (size_t i = 0; i < csrcs_.size(); i++) | |
| 906 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), csrcs_[i]); | |
| 907 | |
| 908 return BuildResult::kSuccess; | 897 return BuildResult::kSuccess; |
| 909 } | 898 } |
| 910 | 899 |
| 911 RTCPSender::BuildResult RTCPSender::BuildReceiverReferenceTime( | 900 RTCPSender::BuildResult RTCPSender::BuildReceiverReferenceTime( |
| 912 RtcpContext* ctx) { | 901 RtcpContext* ctx) { |
| 913 const int kRrTimeBlockLength = 20; | 902 const int kRrTimeBlockLength = 20; |
| 914 if (ctx->position + kRrTimeBlockLength >= IP_PACKET_SIZE) | 903 if (ctx->position + kRrTimeBlockLength >= IP_PACKET_SIZE) |
| 915 return BuildResult::kTruncated; | 904 return BuildResult::kTruncated; |
| 916 | 905 |
| 917 if (last_xr_rr_.size() >= RTCP_NUMBER_OF_SR) | 906 if (last_xr_rr_.size() >= RTCP_NUMBER_OF_SR) |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 | 1337 |
| 1349 bool RTCPSender::AllVolatileFlagsConsumed() const { | 1338 bool RTCPSender::AllVolatileFlagsConsumed() const { |
| 1350 for (const ReportFlag& flag : report_flags_) { | 1339 for (const ReportFlag& flag : report_flags_) { |
| 1351 if (flag.is_volatile) | 1340 if (flag.is_volatile) |
| 1352 return false; | 1341 return false; |
| 1353 } | 1342 } |
| 1354 return true; | 1343 return true; |
| 1355 } | 1344 } |
| 1356 | 1345 |
| 1357 } // namespace webrtc | 1346 } // namespace webrtc |
| OLD | NEW |