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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.cc

Issue 2937403002: Style fixes in rtcp_packet/ (Closed)
Patch Set: CR response Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 24 matching lines...) Expand all
35 // Temporary Maximum Media Stream Bit Rate Notification (TMMBN) (RFC 5104). 35 // Temporary Maximum Media Stream Bit Rate Notification (TMMBN) (RFC 5104).
36 // The Feedback Control Information (FCI) consists of zero, one, or more 36 // The Feedback Control Information (FCI) consists of zero, one, or more
37 // TMMBN FCI entries. 37 // TMMBN FCI entries.
38 // 0 1 2 3 38 // 0 1 2 3
39 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 39 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
40 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 40 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41 // | SSRC | 41 // | SSRC |
42 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 42 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 // | MxTBR Exp | MxTBR Mantissa |Measured Overhead| 43 // | MxTBR Exp | MxTBR Mantissa |Measured Overhead|
44 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 44 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45
46 Tmmbn::Tmmbn() = default;
47
48 Tmmbn::~Tmmbn() = default;
49
45 bool Tmmbn::Parse(const CommonHeader& packet) { 50 bool Tmmbn::Parse(const CommonHeader& packet) {
46 RTC_DCHECK_EQ(packet.type(), kPacketType); 51 RTC_DCHECK_EQ(packet.type(), kPacketType);
47 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); 52 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
48 53
49 if (packet.payload_size_bytes() < kCommonFeedbackLength) { 54 if (packet.payload_size_bytes() < kCommonFeedbackLength) {
50 LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes() 55 LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
51 << " is too small for TMMBN."; 56 << " is too small for TMMBN.";
52 return false; 57 return false;
53 } 58 }
54 size_t items_size_bytes = packet.payload_size_bytes() - kCommonFeedbackLength; 59 size_t items_size_bytes = packet.payload_size_bytes() - kCommonFeedbackLength;
(...skipping 12 matching lines...) Expand all
67 return false; 72 return false;
68 next_item += TmmbItem::kLength; 73 next_item += TmmbItem::kLength;
69 } 74 }
70 return true; 75 return true;
71 } 76 }
72 77
73 void Tmmbn::AddTmmbr(const TmmbItem& item) { 78 void Tmmbn::AddTmmbr(const TmmbItem& item) {
74 items_.push_back(item); 79 items_.push_back(item);
75 } 80 }
76 81
82 size_t Tmmbn::BlockLength() const {
83 return kHeaderLength + kCommonFeedbackLength +
84 TmmbItem::kLength * items_.size();
85 }
86
77 bool Tmmbn::Create(uint8_t* packet, 87 bool Tmmbn::Create(uint8_t* packet,
78 size_t* index, 88 size_t* index,
79 size_t max_length, 89 size_t max_length,
80 RtcpPacket::PacketReadyCallback* callback) const { 90 RtcpPacket::PacketReadyCallback* callback) const {
81 while (*index + BlockLength() > max_length) { 91 while (*index + BlockLength() > max_length) {
82 if (!OnBufferFull(packet, index, callback)) 92 if (!OnBufferFull(packet, index, callback))
83 return false; 93 return false;
84 } 94 }
85 const size_t index_end = *index + BlockLength(); 95 const size_t index_end = *index + BlockLength();
86 96
87 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, 97 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet,
88 index); 98 index);
89 RTC_DCHECK_EQ(0, Rtpfb::media_ssrc()); 99 RTC_DCHECK_EQ(0, Rtpfb::media_ssrc());
90 CreateCommonFeedback(packet + *index); 100 CreateCommonFeedback(packet + *index);
91 *index += kCommonFeedbackLength; 101 *index += kCommonFeedbackLength;
92 for (const TmmbItem& item : items_) { 102 for (const TmmbItem& item : items_) {
93 item.Create(packet + *index); 103 item.Create(packet + *index);
94 *index += TmmbItem::kLength; 104 *index += TmmbItem::kLength;
95 } 105 }
96 RTC_CHECK_EQ(index_end, *index); 106 RTC_CHECK_EQ(index_end, *index);
97 return true; 107 return true;
98 } 108 }
99 } // namespace rtcp 109 } // namespace rtcp
100 } // namespace webrtc 110 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698