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

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

Issue 2199133004: PacketBuffer is now ref counted. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: PacketBuffer/RtpFrameReferenceFinder can now be stopped. Created 4 years, 4 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void RtpFrameReferenceFinder::PaddingReceived(uint16_t seq_num) { 54 void RtpFrameReferenceFinder::PaddingReceived(uint16_t seq_num) {
55 rtc::CritScope lock(&crit_); 55 rtc::CritScope lock(&crit_);
56 auto clean_padding_to = 56 auto clean_padding_to =
57 stashed_padding_.lower_bound(seq_num - kMaxPaddingAge); 57 stashed_padding_.lower_bound(seq_num - kMaxPaddingAge);
58 stashed_padding_.erase(stashed_padding_.begin(), clean_padding_to); 58 stashed_padding_.erase(stashed_padding_.begin(), clean_padding_to);
59 stashed_padding_.insert(seq_num); 59 stashed_padding_.insert(seq_num);
60 UpdateLastPictureIdWithPadding(seq_num); 60 UpdateLastPictureIdWithPadding(seq_num);
61 RetryStashedFrames(); 61 RetryStashedFrames();
62 } 62 }
63 63
64 void RtpFrameReferenceFinder::Stop() {
65 rtc::CritScope lock(&crit_);
66 while (!stashed_frames_.empty())
danilchap 2016/08/02 15:29:34 stashed_frames_.clear() instead? or order of destr
67 stashed_frames_.pop();
68 }
69
64 void RtpFrameReferenceFinder::UpdateLastPictureIdWithPadding(uint16_t seq_num) { 70 void RtpFrameReferenceFinder::UpdateLastPictureIdWithPadding(uint16_t seq_num) {
65 auto gop_seq_num_it = last_seq_num_gop_.upper_bound(seq_num); 71 auto gop_seq_num_it = last_seq_num_gop_.upper_bound(seq_num);
66 72
67 // If this padding packet "belongs" to a group of pictures that we don't track 73 // If this padding packet "belongs" to a group of pictures that we don't track
68 // anymore, do nothing. 74 // anymore, do nothing.
69 if (gop_seq_num_it == last_seq_num_gop_.begin()) 75 if (gop_seq_num_it == last_seq_num_gop_.begin())
70 return; 76 return;
71 --gop_seq_num_it; 77 --gop_seq_num_it;
72 78
73 // Calculate the next contiuous sequence number and search for it in 79 // Calculate the next contiuous sequence number and search for it in
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 if (AheadOf<uint16_t, kPicIdLength>(picture_id, unwrap_truncated)) 546 if (AheadOf<uint16_t, kPicIdLength>(picture_id, unwrap_truncated))
541 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff); 547 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff);
542 else 548 else
543 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff); 549 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff);
544 550
545 return last_unwrap_; 551 return last_unwrap_;
546 } 552 }
547 553
548 } // namespace video_coding 554 } // namespace video_coding
549 } // namespace webrtc 555 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698