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

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

Issue 2370313002: Reland of Unify rtcp packet setters (Closed)
Patch Set: Fix breaking mistype Created 4 years, 2 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 size_t number_of_items = items_size_bytes / TmmbItem::kLength; 64 size_t number_of_items = items_size_bytes / TmmbItem::kLength;
65 items_.resize(number_of_items); 65 items_.resize(number_of_items);
66 for (TmmbItem& item : items_) { 66 for (TmmbItem& item : items_) {
67 if (!item.Parse(next_item)) 67 if (!item.Parse(next_item))
68 return false; 68 return false;
69 next_item += TmmbItem::kLength; 69 next_item += TmmbItem::kLength;
70 } 70 }
71 return true; 71 return true;
72 } 72 }
73 73
74 void Tmmbr::WithTmmbr(const TmmbItem& item) { 74 void Tmmbr::AddTmmbr(const TmmbItem& item) {
75 items_.push_back(item); 75 items_.push_back(item);
76 } 76 }
77 77
78 bool Tmmbr::Create(uint8_t* packet, 78 bool Tmmbr::Create(uint8_t* packet,
79 size_t* index, 79 size_t* index,
80 size_t max_length, 80 size_t max_length,
81 RtcpPacket::PacketReadyCallback* callback) const { 81 RtcpPacket::PacketReadyCallback* callback) const {
82 RTC_DCHECK(!items_.empty()); 82 RTC_DCHECK(!items_.empty());
83 while (*index + BlockLength() > max_length) { 83 while (*index + BlockLength() > max_length) {
84 if (!OnBufferFull(packet, index, callback)) 84 if (!OnBufferFull(packet, index, callback))
85 return false; 85 return false;
86 } 86 }
87 const size_t index_end = *index + BlockLength(); 87 const size_t index_end = *index + BlockLength();
88 88
89 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet, 89 CreateHeader(kFeedbackMessageType, kPacketType, HeaderLength(), packet,
90 index); 90 index);
91 RTC_DCHECK_EQ(0u, Rtpfb::media_ssrc()); 91 RTC_DCHECK_EQ(0u, Rtpfb::media_ssrc());
92 CreateCommonFeedback(packet + *index); 92 CreateCommonFeedback(packet + *index);
93 *index += kCommonFeedbackLength; 93 *index += kCommonFeedbackLength;
94 for (const TmmbItem& item : items_) { 94 for (const TmmbItem& item : items_) {
95 item.Create(packet + *index); 95 item.Create(packet + *index);
96 *index += TmmbItem::kLength; 96 *index += TmmbItem::kLength;
97 } 97 }
98 RTC_CHECK_EQ(index_end, *index); 98 RTC_CHECK_EQ(index_end, *index);
99 return true; 99 return true;
100 } 100 }
101 } // namespace rtcp 101 } // namespace rtcp
102 } // namespace webrtc 102 } // 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/tmmbr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698