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

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

Issue 2841913002: Stashed frames are now retried in a loop rather than recursively. (Closed)
Patch Set: . Created 3 years, 7 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 private: 59 private:
60 static const uint16_t kPicIdLength = 1 << 15; 60 static const uint16_t kPicIdLength = 1 << 15;
61 static const uint8_t kMaxTemporalLayers = 5; 61 static const uint8_t kMaxTemporalLayers = 5;
62 static const int kMaxLayerInfo = 50; 62 static const int kMaxLayerInfo = 50;
63 static const int kMaxStashedFrames = 50; 63 static const int kMaxStashedFrames = 50;
64 static const int kMaxNotYetReceivedFrames = 100; 64 static const int kMaxNotYetReceivedFrames = 100;
65 static const int kMaxGofSaved = 50; 65 static const int kMaxGofSaved = 50;
66 static const int kMaxPaddingAge = 100; 66 static const int kMaxPaddingAge = 100;
67 67
68 enum FrameDecision { kStash, kSend, kDrop };
stefan-webrtc 2017/04/25 15:27:48 kSend sounds like it means that we will send it ov
philipel 2017/04/26 12:22:27 Agree, change to kHandOff since we don't actually
68 69
69 struct GofInfo { 70 struct GofInfo {
70 GofInfo(GofInfoVP9* gof, uint16_t last_picture_id) 71 GofInfo(GofInfoVP9* gof, uint16_t last_picture_id)
71 : gof(gof), last_picture_id(last_picture_id) {} 72 : gof(gof), last_picture_id(last_picture_id) {}
72 GofInfoVP9* gof; 73 GofInfoVP9* gof;
73 uint16_t last_picture_id; 74 uint16_t last_picture_id;
74 }; 75 };
75 76
76 rtc::CriticalSection crit_; 77 rtc::CriticalSection crit_;
77 78
78 // Find the relevant group of pictures and update its "last-picture-id-with 79 // Find the relevant group of pictures and update its "last-picture-id-with
79 // padding" sequence number. 80 // padding" sequence number.
80 void UpdateLastPictureIdWithPadding(uint16_t seq_num) 81 void UpdateLastPictureIdWithPadding(uint16_t seq_num)
81 EXCLUSIVE_LOCKS_REQUIRED(crit_); 82 EXCLUSIVE_LOCKS_REQUIRED(crit_);
82 83
83 // Retry finding references for all frames that previously didn't have 84 // Retry stashed frames until no more complete frames are found.
84 // all information needed.
85 void RetryStashedFrames() EXCLUSIVE_LOCKS_REQUIRED(crit_); 85 void RetryStashedFrames() EXCLUSIVE_LOCKS_REQUIRED(crit_);
86 86
87 FrameDecision ManageFrameInternal(RtpFrameObject* frame)
88 EXCLUSIVE_LOCKS_REQUIRED(crit_);
89
87 // Find references for generic frames. If |picture_id| is unspecified 90 // Find references for generic frames. If |picture_id| is unspecified
88 // then packet sequence numbers will be used to determine the references 91 // then packet sequence numbers will be used to determine the references
89 // of the frames. 92 // of the frames.
90 void ManageFrameGeneric(std::unique_ptr<RtpFrameObject> frame, 93 FrameDecision ManageFrameGeneric(RtpFrameObject* frame, int picture_id)
91 int picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_); 94 EXCLUSIVE_LOCKS_REQUIRED(crit_);
92 95
93 // Find references for Vp8 frames 96 // Find references for Vp8 frames
94 void ManageFrameVp8(std::unique_ptr<RtpFrameObject> frame) 97 FrameDecision ManageFrameVp8(RtpFrameObject* frame)
95 EXCLUSIVE_LOCKS_REQUIRED(crit_); 98 EXCLUSIVE_LOCKS_REQUIRED(crit_);
96 99
97 // Updates all necessary state used to determine frame references 100 // Updates all necessary state used to determine frame references
98 // for Vp8 and then calls the |frame_callback| callback with the 101 // for Vp8 and then calls the |frame_callback| callback with the
99 // completed frame. 102 // completed frame.
100 void CompletedFrameVp8(std::unique_ptr<RtpFrameObject> frame) 103 void CompletedFrameVp8(RtpFrameObject* frame) EXCLUSIVE_LOCKS_REQUIRED(crit_);
101 EXCLUSIVE_LOCKS_REQUIRED(crit_);
102 104
103 // Find references for Vp9 frames 105 // Find references for Vp9 frames
104 void ManageFrameVp9(std::unique_ptr<RtpFrameObject> frame) 106 FrameDecision ManageFrameVp9(RtpFrameObject* frame)
105 EXCLUSIVE_LOCKS_REQUIRED(crit_); 107 EXCLUSIVE_LOCKS_REQUIRED(crit_);
106 108
107 // Unwrap the picture id and the frame references and then call the 109 // Unwrap the picture id and the frame references and then call the
108 // |frame_callback| callback with the completed frame. 110 // |frame_callback| callback with the completed frame.
109 void CompletedFrameVp9(std::unique_ptr<RtpFrameObject> frame) 111 void CompletedFrameVp9(RtpFrameObject* frame) EXCLUSIVE_LOCKS_REQUIRED(crit_);
110 EXCLUSIVE_LOCKS_REQUIRED(crit_);
111 112
112 // Check if we are missing a frame necessary to determine the references 113 // Check if we are missing a frame necessary to determine the references
113 // for this frame. 114 // for this frame.
114 bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfo& info) 115 bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfo& info)
115 EXCLUSIVE_LOCKS_REQUIRED(crit_); 116 EXCLUSIVE_LOCKS_REQUIRED(crit_);
116 117
117 // Updates which frames that have been received. If there is a gap, 118 // Updates which frames that have been received. If there is a gap,
118 // missing frames will be added to |missing_frames_for_layer_| or 119 // missing frames will be added to |missing_frames_for_layer_| or
119 // if this is an already missing frame then it will be removed. 120 // if this is an already missing frame then it will be removed.
120 void FrameReceivedVp9(uint16_t picture_id, GofInfo* info) 121 void FrameReceivedVp9(uint16_t picture_id, GofInfo* info)
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 int vp9_fix_last_picture_id_ = -1; 223 int vp9_fix_last_picture_id_ = -1;
223 int vp9_fix_pid_offset_ = 0; 224 int vp9_fix_pid_offset_ = 0;
224 int vp9_fix_last_tl0_pic_idx_ = -1; 225 int vp9_fix_last_tl0_pic_idx_ = -1;
225 int vp9_fix_tl0_pic_idx_offset_ = 0; 226 int vp9_fix_tl0_pic_idx_offset_ = 0;
226 }; 227 };
227 228
228 } // namespace video_coding 229 } // namespace video_coding
229 } // namespace webrtc 230 } // namespace webrtc
230 231
231 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ 232 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698