Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc

Issue 1261323003: Use RtcpPacket to send FIR in RtcpSender (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Increment seq even if truncated Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if (!ctx->repeat)
568 if (ctx->position + 20 >= IP_PACKET_SIZE) 568 ++sequence_number_fir_; // Do not increase if repetition.
569
570 rtcp::Fir fir;
571 fir.From(ssrc_);
572 fir.To(remote_ssrc_);
573 fir.WithCommandSeqNum(sequence_number_fir_);
574
575 PacketBuiltCallback callback(ctx);
576 if (!callback.BuildPacket(fir))
569 return BuildResult::kTruncated; 577 return BuildResult::kTruncated;
570 578
571 if (!ctx->repeat)
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
598 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), 579 TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
599 "RTCPSender::FIR"); 580 "RTCPSender::FIR");
600 ++packet_type_counter_.fir_packets; 581 ++packet_type_counter_.fir_packets;
601 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_FIRCount", 582 TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_FIRCount",
602 ssrc_, packet_type_counter_.fir_packets); 583 ssrc_, packet_type_counter_.fir_packets);
603 584
604 return BuildResult::kSuccess; 585 return BuildResult::kSuccess;
605 } 586 }
606 587
607 /* 588 /*
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 1469
1489 bool RTCPSender::AllVolatileFlagsConsumed() const { 1470 bool RTCPSender::AllVolatileFlagsConsumed() const {
1490 for (const ReportFlag& flag : report_flags_) { 1471 for (const ReportFlag& flag : report_flags_) {
1491 if (flag.is_volatile) 1472 if (flag.is_volatile)
1492 return false; 1473 return false;
1493 } 1474 }
1494 return true; 1475 return true;
1495 } 1476 }
1496 1477
1497 } // namespace webrtc 1478 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698