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

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

Issue 2051453002: Padding is now used to check for continuity in the packet sequence. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Nit fix. Created 4 years, 5 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 15 matching lines...) Expand all
26 namespace webrtc { 26 namespace webrtc {
27 namespace video_coding { 27 namespace video_coding {
28 28
29 class RtpFrameObject; 29 class RtpFrameObject;
30 class OnCompleteFrameCallback; 30 class OnCompleteFrameCallback;
31 31
32 class RtpFrameReferenceFinder { 32 class RtpFrameReferenceFinder {
33 public: 33 public:
34 explicit RtpFrameReferenceFinder(OnCompleteFrameCallback* frame_callback); 34 explicit RtpFrameReferenceFinder(OnCompleteFrameCallback* frame_callback);
35 void ManageFrame(std::unique_ptr<RtpFrameObject> frame); 35 void ManageFrame(std::unique_ptr<RtpFrameObject> frame);
36 void PaddingReceived(uint16_t seq_num);
36 37
37 private: 38 private:
38 static const uint16_t kPicIdLength = 1 << 7; 39 static const uint16_t kPicIdLength = 1 << 7;
39 static const uint8_t kMaxTemporalLayers = 5; 40 static const uint8_t kMaxTemporalLayers = 5;
40 static const int kMaxLayerInfo = 10; 41 static const int kMaxLayerInfo = 10;
41 static const int kMaxStashedFrames = 10; 42 static const int kMaxStashedFrames = 10;
42 static const int kMaxNotYetReceivedFrames = 20; 43 static const int kMaxNotYetReceivedFrames = 20;
43 static const int kMaxGofSaved = 15; 44 static const int kMaxGofSaved = 15;
45 static const int kMaxPaddingAge = 100;
44 46
45 rtc::CriticalSection crit_; 47 rtc::CriticalSection crit_;
46 48
49 // Find the relevant group of pictures and update its "last-picture-id-with
50 // padding" sequence number.
51 void UpdateLastPictureIdWithPadding(uint16_t seq_num)
52 EXCLUSIVE_LOCKS_REQUIRED(crit_);
53
47 // Retry finding references for all frames that previously didn't have 54 // Retry finding references for all frames that previously didn't have
48 // all information needed. 55 // all information needed.
49 void RetryStashedFrames() EXCLUSIVE_LOCKS_REQUIRED(crit_); 56 void RetryStashedFrames() EXCLUSIVE_LOCKS_REQUIRED(crit_);
50 57
51 // Find references for generic frames. If |picture_id| is unspecified 58 // Find references for generic frames. If |picture_id| is unspecified
52 // then packet sequence numbers will be used to determine the references 59 // then packet sequence numbers will be used to determine the references
53 // of the frames. 60 // of the frames.
54 void ManageFrameGeneric(std::unique_ptr<RtpFrameObject> frame, 61 void ManageFrameGeneric(std::unique_ptr<RtpFrameObject> frame,
55 int picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_); 62 int picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_);
56 63
(...skipping 29 matching lines...) Expand all
86 93
87 // Check if there is a frame with the up-switch flag set in the interval 94 // Check if there is a frame with the up-switch flag set in the interval
88 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|. 95 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|.
89 bool UpSwitchInIntervalVp9(uint16_t picture_id, 96 bool UpSwitchInIntervalVp9(uint16_t picture_id,
90 uint8_t temporal_idx, 97 uint8_t temporal_idx,
91 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_); 98 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_);
92 99
93 // All picture ids are unwrapped to 16 bits. 100 // All picture ids are unwrapped to 16 bits.
94 uint16_t UnwrapPictureId(uint16_t picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_); 101 uint16_t UnwrapPictureId(uint16_t picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_);
95 102
96 // Holds the last sequence number of the last frame that has been created 103
97 // given the last sequence number of a given keyframe. 104 // For every group of pictures, hold two sequence numbers. The first being
98 std::map<uint16_t, uint16_t, DescendingSeqNumComp<uint16_t>> last_seq_num_gop_ 105 // the sequence number of the last packet of the last completed frame, and
99 GUARDED_BY(crit_); 106 // the second being the sequence number of the last packet of the last
107 // completed frame advanced by any potential continuous packets of padding.
108 std::map<uint16_t,
109 std::pair<uint16_t, uint16_t>,
110 DescendingSeqNumComp<uint16_t>>
111 last_seq_num_gop_ GUARDED_BY(crit_);
100 112
101 // Save the last picture id in order to detect when there is a gap in frames 113 // Save the last picture id in order to detect when there is a gap in frames
102 // that have not yet been fully received. 114 // that have not yet been fully received.
103 int last_picture_id_ GUARDED_BY(crit_); 115 int last_picture_id_ GUARDED_BY(crit_);
104 116
117 // Padding packets that have been received but that are not yet continuous
118 // with any group of pictures.
119 std::set<uint16_t, DescendingSeqNumComp<uint16_t>> stashed_padding_
120 GUARDED_BY(crit_);
121
105 // The last unwrapped picture id. Used to unwrap the picture id from a length 122 // The last unwrapped picture id. Used to unwrap the picture id from a length
106 // of |kPicIdLength| to 16 bits. 123 // of |kPicIdLength| to 16 bits.
107 int last_unwrap_ GUARDED_BY(crit_); 124 int last_unwrap_ GUARDED_BY(crit_);
108 125
109 // Frames earlier than the last received frame that have not yet been 126 // Frames earlier than the last received frame that have not yet been
110 // fully received. 127 // fully received.
111 std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>> 128 std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>
112 not_yet_received_frames_ GUARDED_BY(crit_); 129 not_yet_received_frames_ GUARDED_BY(crit_);
113 130
114 // Frames that have been fully received but didn't have all the information 131 // Frames that have been fully received but didn't have all the information
(...skipping 30 matching lines...) Expand all
145 kMaxTemporalLayers> 162 kMaxTemporalLayers>
146 missing_frames_for_layer_ GUARDED_BY(crit_); 163 missing_frames_for_layer_ GUARDED_BY(crit_);
147 164
148 OnCompleteFrameCallback* frame_callback_; 165 OnCompleteFrameCallback* frame_callback_;
149 }; 166 };
150 167
151 } // namespace video_coding 168 } // namespace video_coding
152 } // namespace webrtc 169 } // namespace webrtc
153 170
154 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ 171 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/packet_buffer.cc ('k') | webrtc/modules/video_coding/rtp_frame_reference_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698