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

Side by Side Diff: webrtc/modules/video_coding/packet_buffer.cc

Issue 1988653002: PacketBuffer now can save how many times a packet has been nacked. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: combined_size to frame_size Created 4 years, 7 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 void PacketBuffer::FindFrames(uint16_t seq_num) { 132 void PacketBuffer::FindFrames(uint16_t seq_num) {
133 size_t index = seq_num % size_; 133 size_t index = seq_num % size_;
134 while (IsContinuous(seq_num)) { 134 while (IsContinuous(seq_num)) {
135 sequence_buffer_[index].continuous = true; 135 sequence_buffer_[index].continuous = true;
136 136
137 // If all packets of the frame is continuous, find the first packet of the 137 // If all packets of the frame is continuous, find the first packet of the
138 // frame and create an RtpFrameObject. 138 // frame and create an RtpFrameObject.
139 if (sequence_buffer_[index].frame_end) { 139 if (sequence_buffer_[index].frame_end) {
140 int start_index = index; 140 size_t frame_size = 0;
141 int8_t max_nack_count = -1;
141 uint16_t start_seq_num = seq_num; 142 uint16_t start_seq_num = seq_num;
142 143
144 // Find the start index by searching backward until the packet with
145 // the |frame_begin| flag is set.
146 int start_index = index;
143 while (!sequence_buffer_[start_index].frame_begin) { 147 while (!sequence_buffer_[start_index].frame_begin) {
stefan-webrtc 2016/05/23 13:01:25 Can this be a do ... while instead so that you don
philipel 2016/05/23 13:34:18 Cleaned it up a bit, can't really use do-while in
148 frame_size += data_buffer_[start_index].sizeBytes;
149 max_nack_count = std::max<int8_t>(
stefan-webrtc 2016/05/23 13:01:25 int
philipel 2016/05/23 13:34:18 Done.
150 max_nack_count, data_buffer_[start_index].timesNacked);
144 sequence_buffer_[start_index].frame_created = true; 151 sequence_buffer_[start_index].frame_created = true;
145 start_index = start_index > 0 ? start_index - 1 : size_ - 1; 152 start_index = start_index > 0 ? start_index - 1 : size_ - 1;
146 start_seq_num--; 153 start_seq_num--;
147 } 154 }
155 frame_size += data_buffer_[start_index].sizeBytes;
156 max_nack_count = std::max<int8_t>(
stefan-webrtc 2016/05/23 13:01:25 int
157 max_nack_count, data_buffer_[start_index].timesNacked);
148 sequence_buffer_[start_index].frame_created = true; 158 sequence_buffer_[start_index].frame_created = true;
149 159
150 std::unique_ptr<RtpFrameObject> frame( 160 std::unique_ptr<RtpFrameObject> frame(new RtpFrameObject(
151 new RtpFrameObject(this, start_seq_num, seq_num)); 161 this, start_seq_num, seq_num, frame_size, max_nack_count));
152 reference_finder_.ManageFrame(std::move(frame)); 162 reference_finder_.ManageFrame(std::move(frame));
153 } 163 }
154 164
155 index = (index + 1) % size_; 165 index = (index + 1) % size_;
156 ++seq_num; 166 ++seq_num;
157 } 167 }
158 } 168 }
159 169
160 void PacketBuffer::ReturnFrame(RtpFrameObject* frame) { 170 void PacketBuffer::ReturnFrame(RtpFrameObject* frame) {
161 rtc::CritScope lock(&crit_); 171 rtc::CritScope lock(&crit_);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 void PacketBuffer::Clear() { 224 void PacketBuffer::Clear() {
215 rtc::CritScope lock(&crit_); 225 rtc::CritScope lock(&crit_);
216 for (size_t i = 0; i < size_; ++i) 226 for (size_t i = 0; i < size_; ++i)
217 sequence_buffer_[i].used = false; 227 sequence_buffer_[i].used = false;
218 228
219 first_packet_received_ = false; 229 first_packet_received_ = false;
220 } 230 }
221 231
222 } // namespace video_coding 232 } // namespace video_coding
223 } // namespace webrtc 233 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698