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

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.
304 if (AheadOf<uint16_t, kPicIdLength>(layer_info_it->second[layer],
305 frame->picture_id)) {
306 return;
307 }
308
301 // If we have not yet received a frame between this frame and the referenced 309 // 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. 310 // frame then we have to wait for that frame to be completed first.
303 auto not_received_frame_it = 311 auto not_received_frame_it =
304 not_yet_received_frames_.upper_bound(layer_info_it->second[layer]); 312 not_yet_received_frames_.upper_bound(layer_info_it->second[layer]);
305 if (not_received_frame_it != not_yet_received_frames_.end() && 313 if (not_received_frame_it != not_yet_received_frames_.end() &&
306 AheadOf<uint16_t, kPicIdLength>(frame->picture_id, 314 AheadOf<uint16_t, kPicIdLength>(frame->picture_id,
307 *not_received_frame_it)) { 315 *not_received_frame_it)) {
308 stashed_frames_.push_back(std::move(frame)); 316 stashed_frames_.push_back(std::move(frame));
309 return; 317 return;
310 } 318 }
311 319
320 RTC_DCHECK((AheadOf<uint16_t, kPicIdLength>(frame->picture_id,
321 layer_info_it->second[layer])));
312 ++frame->num_references; 322 ++frame->num_references;
313 frame->references[layer] = layer_info_it->second[layer]; 323 frame->references[layer] = layer_info_it->second[layer];
314 } 324 }
315 325
316 CompletedFrameVp8(std::move(frame)); 326 CompletedFrameVp8(std::move(frame));
317 } 327 }
318 328
319 void RtpFrameReferenceFinder::CompletedFrameVp8( 329 void RtpFrameReferenceFinder::CompletedFrameVp8(
320 std::unique_ptr<RtpFrameObject> frame) { 330 std::unique_ptr<RtpFrameObject> frame) {
321 RTPVideoTypeHeader* rtp_codec_header = frame->GetCodecHeader(); 331 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)) 579 if (AheadOf<uint16_t, kPicIdLength>(picture_id, unwrap_truncated))
570 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff); 580 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff);
571 else 581 else
572 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff); 582 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff);
573 583
574 return last_unwrap_; 584 return last_unwrap_;
575 } 585 }
576 586
577 } // namespace video_coding 587 } // namespace video_coding
578 } // namespace webrtc 588 } // 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