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

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

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

Powered by Google App Engine
This is Rietveld 408576698