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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.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 25 matching lines...) Expand all
36 // The Feedback Control Information (FCI) for the TMMBR 36 // The Feedback Control Information (FCI) for the TMMBR
37 // consists of one or more FCI entries. 37 // consists of one or more FCI entries.
38 // FCI: 38 // FCI:
39 // 0 1 2 3 39 // 0 1 2 3
40 // 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 // 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
41 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 41 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
42 // | SSRC | 42 // | SSRC |
43 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 43 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
44 // | MxTBR Exp | MxTBR Mantissa |Measured Overhead| 44 // | MxTBR Exp | MxTBR Mantissa |Measured Overhead|
45 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 45 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
46
47 Tmmbr::Tmmbr() = default;
48
49 Tmmbr::~Tmmbr() = default;
50
46 bool Tmmbr::Parse(const CommonHeader& packet) { 51 bool Tmmbr::Parse(const CommonHeader& packet) {
47 RTC_DCHECK_EQ(packet.type(), kPacketType); 52 RTC_DCHECK_EQ(packet.type(), kPacketType);
48 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType); 53 RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
49 54
50 if (packet.payload_size_bytes() < kCommonFeedbackLength + TmmbItem::kLength) { 55 if (packet.payload_size_bytes() < kCommonFeedbackLength + TmmbItem::kLength) {
51 LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes() 56 LOG(LS_WARNING) << "Payload length " << packet.payload_size_bytes()
52 << " is too small for a TMMBR."; 57 << " is too small for a TMMBR.";
53 return false; 58 return false;
54 } 59 }
55 size_t items_size_bytes = packet.payload_size_bytes() - kCommonFeedbackLength; 60 size_t items_size_bytes = packet.payload_size_bytes() - kCommonFeedbackLength;
(...skipping 12 matching lines...) Expand all
68 return false; 73 return false;
69 next_item += TmmbItem::kLength; 74 next_item += TmmbItem::kLength;
70 } 75 }
71 return true; 76 return true;
72 } 77 }
73 78
74 void Tmmbr::AddTmmbr(const TmmbItem& item) { 79 void Tmmbr::AddTmmbr(const TmmbItem& item) {
75 items_.push_back(item); 80 items_.push_back(item);
76 } 81 }
77 82
83 size_t Tmmbr::BlockLength() const {
84 return kHeaderLength + kCommonFeedbackLength +
85 TmmbItem::kLength * items_.size();
86 }
87
78 bool Tmmbr::Create(uint8_t* packet, 88 bool Tmmbr::Create(uint8_t* packet,
79 size_t* index, 89 size_t* index,
80 size_t max_length, 90 size_t max_length,
81 RtcpPacket::PacketReadyCallback* callback) const { 91 RtcpPacket::PacketReadyCallback* callback) const {
82 RTC_DCHECK(!items_.empty()); 92 RTC_DCHECK(!items_.empty());
83 while (*index + BlockLength() > max_length) { 93 while (*index + BlockLength() > max_length) {
84 if (!OnBufferFull(packet, index, callback)) 94 if (!OnBufferFull(packet, index, callback))
85 return false; 95 return false;
86 } 96 }
87 const size_t index_end = *index + BlockLength(); 97 const size_t index_end = *index + BlockLength();
88 98
89 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, 99 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet,
90 index); 100 index);
91 RTC_DCHECK_EQ(0, Rtpfb::media_ssrc()); 101 RTC_DCHECK_EQ(0, Rtpfb::media_ssrc());
92 CreateCommonFeedback(packet + *index); 102 CreateCommonFeedback(packet + *index);
93 *index += kCommonFeedbackLength; 103 *index += kCommonFeedbackLength;
94 for (const TmmbItem& item : items_) { 104 for (const TmmbItem& item : items_) {
95 item.Create(packet + *index); 105 item.Create(packet + *index);
96 *index += TmmbItem::kLength; 106 *index += TmmbItem::kLength;
97 } 107 }
98 RTC_CHECK_EQ(index_end, *index); 108 RTC_CHECK_EQ(index_end, *index);
99 return true; 109 return true;
100 } 110 }
101 } // namespace rtcp 111 } // namespace rtcp
102 } // namespace webrtc 112 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698