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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 557 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
558 "RTCPSender::PLI"); | 558 "RTCPSender::PLI"); |
559 ++packet_type_counter_.pli_packets; | 559 ++packet_type_counter_.pli_packets; |
560 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_PLICount", | 560 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_PLICount", |
561 ssrc_, packet_type_counter_.pli_packets); | 561 ssrc_, packet_type_counter_.pli_packets); |
562 | 562 |
563 return BuildResult::kSuccess; | 563 return BuildResult::kSuccess; |
564 } | 564 } |
565 | 565 |
566 RTCPSender::BuildResult RTCPSender::BuildFIR(RtcpContext* ctx) { | 566 RTCPSender::BuildResult RTCPSender::BuildFIR(RtcpContext* ctx) { |
567 // sanity | 567 uint8_t seq = sequence_number_fir_; |
568 if (ctx->position + 20 >= IP_PACKET_SIZE) | 568 if (!ctx->repeat) |
569 ++seq; // Do not increase if repetition. | |
570 | |
571 rtcp::Fir fir; | |
572 fir.From(ssrc_); | |
573 fir.To(remote_ssrc_); | |
574 fir.WithCommandSeqNum(seq); | |
575 | |
576 PacketBuiltCallback callback(ctx); | |
577 if (!callback.BuildPacket(fir)) | |
569 return BuildResult::kTruncated; | 578 return BuildResult::kTruncated; |
570 | 579 |
571 if (!ctx->repeat) | 580 sequence_number_fir_ = seq; // Only update if we actually sent packet. |
åsapersson
2015/08/04 12:07:27
Will the caller know if the FIR request is not sen
sprang_webrtc
2015/08/04 12:59:38
I updated the comment to the more clear "Update st
| |
572 sequence_number_fir_++; // do not increase if repetition | |
573 | |
574 // add full intra request indicator | |
575 uint8_t FMT = 4; | |
576 *ctx->AllocateData(1) = 0x80 + FMT; | |
577 *ctx->AllocateData(1) = 206; | |
578 | |
579 //Length of 4 | |
580 *ctx->AllocateData(1) = 0; | |
581 *ctx->AllocateData(1) = 4; | |
582 | |
583 // Add our own SSRC | |
584 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), ssrc_); | |
585 | |
586 // RFC 5104 4.3.1.2. Semantics | |
587 // SSRC of media source | |
588 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), 0); | |
589 | |
590 // Additional Feedback Control Information (FCI) | |
591 ByteWriter<uint32_t>::WriteBigEndian(ctx->AllocateData(4), remote_ssrc_); | |
592 | |
593 *ctx->AllocateData(1) = sequence_number_fir_; | |
594 *ctx->AllocateData(1) = 0; | |
595 *ctx->AllocateData(1) = 0; | |
596 *ctx->AllocateData(1) = 0; | |
597 | 581 |
598 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 582 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
599 "RTCPSender::FIR"); | 583 "RTCPSender::FIR"); |
600 ++packet_type_counter_.fir_packets; | 584 ++packet_type_counter_.fir_packets; |
601 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_FIRCount", | 585 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_FIRCount", |
602 ssrc_, packet_type_counter_.fir_packets); | 586 ssrc_, packet_type_counter_.fir_packets); |
603 | 587 |
604 return BuildResult::kSuccess; | 588 return BuildResult::kSuccess; |
605 } | 589 } |
606 | 590 |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1488 | 1472 |
1489 bool RTCPSender::AllVolatileFlagsConsumed() const { | 1473 bool RTCPSender::AllVolatileFlagsConsumed() const { |
1490 for (const ReportFlag& flag : report_flags_) { | 1474 for (const ReportFlag& flag : report_flags_) { |
1491 if (flag.is_volatile) | 1475 if (flag.is_volatile) |
1492 return false; | 1476 return false; |
1493 } | 1477 } |
1494 return true; | 1478 return true; |
1495 } | 1479 } |
1496 | 1480 |
1497 } // namespace webrtc | 1481 } // namespace webrtc |
OLD | NEW |