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

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

Issue 2392313002: Drop VP8 frames older than the last sync frame in the RtpFrameReferenceFinder. (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
« no previous file with comments | « no previous file | webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc » ('j') | 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 // Find all references for this frame. 291 // Find all references for this frame.
292 frame->num_references = 0; 292 frame->num_references = 0;
293 for (uint8_t layer = 0; layer <= codec_header.temporalIdx; ++layer) { 293 for (uint8_t layer = 0; layer <= codec_header.temporalIdx; ++layer) {
294 // If we have not yet received a previous frame on this temporal layer, 294 // If we have not yet received a previous frame on this temporal layer,
295 // stash this frame. 295 // stash this frame.
296 if (layer_info_it->second[layer] == -1) { 296 if (layer_info_it->second[layer] == -1) {
297 stashed_frames_.push_back(std::move(frame)); 297 stashed_frames_.push_back(std::move(frame));
298 return; 298 return;
299 } 299 }
300 300
301 // If the last frame on this layer is ahead of this frame it means that
302 // a layer sync frame has been received after this frame for the same
303 // base layer frame, drop this frame.
stefan-webrtc 2016/10/05 14:05:58 Is this always true though? What if we received a
philipel 2016/10/05 14:47:42 I can't find a case where this it not true, rememb
304 if (AheadOf<uint16_t, kPicIdLength>(layer_info_it->second[layer],
305 frame->picture_id))
stefan-webrtc 2016/10/05 14:05:58 {}
philipel 2016/10/05 14:47:42 Done.
306 return;
307
301 // If we have not yet received a frame between this frame and the referenced 308 // If we have not yet received a frame between this frame and the referenced
302 // frame then we have to wait for that frame to be completed first. 309 // frame then we have to wait for that frame to be completed first.
303 auto not_received_frame_it = 310 auto not_received_frame_it =
304 not_yet_received_frames_.upper_bound(layer_info_it->second[layer]); 311 not_yet_received_frames_.upper_bound(layer_info_it->second[layer]);
305 if (not_received_frame_it != not_yet_received_frames_.end() && 312 if (not_received_frame_it != not_yet_received_frames_.end() &&
306 AheadOf<uint16_t, kPicIdLength>(frame->picture_id, 313 AheadOf<uint16_t, kPicIdLength>(frame->picture_id,
307 *not_received_frame_it)) { 314 *not_received_frame_it)) {
308 stashed_frames_.push_back(std::move(frame)); 315 stashed_frames_.push_back(std::move(frame));
309 return; 316 return;
310 } 317 }
311 318
319 RTC_DCHECK(AheadOf(frame->picture_id, layer_info_it->second[layer]));
312 ++frame->num_references; 320 ++frame->num_references;
313 frame->references[layer] = layer_info_it->second[layer]; 321 frame->references[layer] = layer_info_it->second[layer];
314 } 322 }
315 323
316 CompletedFrameVp8(std::move(frame)); 324 CompletedFrameVp8(std::move(frame));
317 } 325 }
318 326
319 void RtpFrameReferenceFinder::CompletedFrameVp8( 327 void RtpFrameReferenceFinder::CompletedFrameVp8(
320 std::unique_ptr<RtpFrameObject> frame) { 328 std::unique_ptr<RtpFrameObject> frame) {
321 RTPVideoTypeHeader* rtp_codec_header = frame->GetCodecHeader(); 329 RTPVideoTypeHeader* rtp_codec_header = frame->GetCodecHeader();
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (AheadOf<uint16_t, kPicIdLength>(picture_id, unwrap_truncated)) 577 if (AheadOf<uint16_t, kPicIdLength>(picture_id, unwrap_truncated))
570 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff); 578 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff);
571 else 579 else
572 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff); 580 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff);
573 581
574 return last_unwrap_; 582 return last_unwrap_;
575 } 583 }
576 584
577 } // namespace video_coding 585 } // namespace video_coding
578 } // namespace webrtc 586 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698