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

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

Issue 2675693002: video_coding::PacketBuffer now group all H264 packets with the same timestamp into the same frame. (Closed)
Patch Set: . Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // If all packets of the frame is continuous, find the first packet of the 204 // If all packets of the frame is continuous, find the first packet of the
205 // frame and create an RtpFrameObject. 205 // frame and create an RtpFrameObject.
206 if (sequence_buffer_[index].frame_end) { 206 if (sequence_buffer_[index].frame_end) {
207 size_t frame_size = 0; 207 size_t frame_size = 0;
208 int max_nack_count = -1; 208 int max_nack_count = -1;
209 uint16_t start_seq_num = seq_num; 209 uint16_t start_seq_num = seq_num;
210 210
211 // Find the start index by searching backward until the packet with 211 // Find the start index by searching backward until the packet with
212 // the |frame_begin| flag is set. 212 // the |frame_begin| flag is set.
213 int start_index = index; 213 int start_index = index;
214
215 bool is_h264 = data_buffer_[start_index].codec == kVideoCodecH264;
216 int64_t frame_timestamp = data_buffer_[start_index].timestamp;
214 while (true) { 217 while (true) {
215 frame_size += data_buffer_[start_index].sizeBytes; 218 frame_size += data_buffer_[start_index].sizeBytes;
216 max_nack_count = 219 max_nack_count =
217 std::max(max_nack_count, data_buffer_[start_index].timesNacked); 220 std::max(max_nack_count, data_buffer_[start_index].timesNacked);
218 sequence_buffer_[start_index].frame_created = true; 221 sequence_buffer_[start_index].frame_created = true;
219 222
220 if (sequence_buffer_[start_index].frame_begin) 223 if (!is_h264 && sequence_buffer_[start_index].frame_begin)
221 break; 224 break;
222 225
223 start_index = start_index > 0 ? start_index - 1 : size_ - 1; 226 start_index = start_index > 0 ? start_index - 1 : size_ - 1;
224 start_seq_num--; 227
228 if (is_h264 && start_index != static_cast<int>(index) &&
stefan-webrtc 2017/02/02 15:19:00 Can we have a short comment on what this is trying
philipel 2017/02/02 15:47:37 Added a comment about it.
229 (!sequence_buffer_[start_index].used ||
230 data_buffer_[start_index].timestamp != frame_timestamp)) {
231 break;
232 }
233
234 --start_seq_num;
225 } 235 }
226 236
227 found_frames.emplace_back( 237 found_frames.emplace_back(
228 new RtpFrameObject(this, start_seq_num, seq_num, frame_size, 238 new RtpFrameObject(this, start_seq_num, seq_num, frame_size,
229 max_nack_count, clock_->TimeInMilliseconds())); 239 max_nack_count, clock_->TimeInMilliseconds()));
230 } 240 }
231 ++seq_num; 241 ++seq_num;
232 ++packets_tested; 242 ++packets_tested;
233 } 243 }
234 return found_frames; 244 return found_frames;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 int PacketBuffer::Release() const { 300 int PacketBuffer::Release() const {
291 int count = rtc::AtomicOps::Decrement(&ref_count_); 301 int count = rtc::AtomicOps::Decrement(&ref_count_);
292 if (!count) { 302 if (!count) {
293 delete this; 303 delete this;
294 } 304 }
295 return count; 305 return count;
296 } 306 }
297 307
298 } // namespace video_coding 308 } // namespace video_coding
299 } // namespace webrtc 309 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698