| OLD | NEW |
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // of the frames. | 92 // of the frames. |
| 93 FrameDecision ManageFrameGeneric(RtpFrameObject* frame, int picture_id) | 93 FrameDecision ManageFrameGeneric(RtpFrameObject* frame, int picture_id) |
| 94 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 94 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 95 | 95 |
| 96 // Find references for Vp8 frames | 96 // Find references for Vp8 frames |
| 97 FrameDecision ManageFrameVp8(RtpFrameObject* frame) | 97 FrameDecision ManageFrameVp8(RtpFrameObject* frame) |
| 98 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 98 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 99 | 99 |
| 100 // Updates necessary layer info state used to determine frame references for | 100 // Updates necessary layer info state used to determine frame references for |
| 101 // Vp8. | 101 // Vp8. |
| 102 void UpdateLayerInfoVp8(RtpFrameObject* frame, | 102 void UpdateLayerInfoVp8(RtpFrameObject* frame) |
| 103 const RTPVideoHeaderVP8& codec_header) | |
| 104 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 103 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 105 | 104 |
| 106 // Find references for Vp9 frames | 105 // Find references for Vp9 frames |
| 107 FrameDecision ManageFrameVp9(RtpFrameObject* frame) | 106 FrameDecision ManageFrameVp9(RtpFrameObject* frame) |
| 108 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 107 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 109 | 108 |
| 110 // Check if we are missing a frame necessary to determine the references | 109 // Check if we are missing a frame necessary to determine the references |
| 111 // for this frame. | 110 // for this frame. |
| 112 bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfo& info) | 111 bool MissingRequiredFrameVp9(uint16_t picture_id, const GofInfo& info) |
| 113 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 112 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 114 | 113 |
| 115 // Updates which frames that have been received. If there is a gap, | 114 // Updates which frames that have been received. If there is a gap, |
| 116 // missing frames will be added to |missing_frames_for_layer_| or | 115 // missing frames will be added to |missing_frames_for_layer_| or |
| 117 // if this is an already missing frame then it will be removed. | 116 // if this is an already missing frame then it will be removed. |
| 118 void FrameReceivedVp9(uint16_t picture_id, GofInfo* info) | 117 void FrameReceivedVp9(uint16_t picture_id, GofInfo* info) |
| 119 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 118 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 120 | 119 |
| 121 // Check if there is a frame with the up-switch flag set in the interval | 120 // Check if there is a frame with the up-switch flag set in the interval |
| 122 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|. | 121 // (|pid_ref|, |picture_id|) with temporal layer smaller than |temporal_idx|. |
| 123 bool UpSwitchInIntervalVp9(uint16_t picture_id, | 122 bool UpSwitchInIntervalVp9(uint16_t picture_id, |
| 124 uint8_t temporal_idx, | 123 uint8_t temporal_idx, |
| 125 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 124 uint16_t pid_ref) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 126 | 125 |
| 127 // Unwrap |frame|s picture id and its references to 16 bits. | 126 // Unwrap |frame|s picture id and its references to 16 bits. |
| 128 void UnwrapPictureIds(RtpFrameObject* frame) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 127 void UnwrapPictureIds(RtpFrameObject* frame) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 129 // All picture ids are unwrapped to 16 bits. | |
| 130 uint16_t UnwrapPictureId(uint16_t picture_id) EXCLUSIVE_LOCKS_REQUIRED(crit_); | |
| 131 | 128 |
| 132 // Returns true if the frame is old and should be dropped. | 129 // Returns true if the frame is old and should be dropped. |
| 133 // TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be | 130 // TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be |
| 134 // around M59). | 131 // around M59). |
| 135 bool Vp9PidTl0Fix(const RtpFrameObject& frame, | 132 bool Vp9PidTl0Fix(const RtpFrameObject& frame, |
| 136 int16_t* picture_id, | 133 int16_t* picture_id, |
| 137 int16_t* tl0_pic_idx) EXCLUSIVE_LOCKS_REQUIRED(crit_); | 134 int16_t* tl0_pic_idx) EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 138 | 135 |
| 139 // TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be | 136 // TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be |
| 140 // around M59). | 137 // around M59). |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>, | 204 std::array<std::set<uint16_t, DescendingSeqNumComp<uint16_t, kPicIdLength>>, |
| 208 kMaxTemporalLayers> | 205 kMaxTemporalLayers> |
| 209 missing_frames_for_layer_ GUARDED_BY(crit_); | 206 missing_frames_for_layer_ GUARDED_BY(crit_); |
| 210 | 207 |
| 211 // How far frames have been cleared by sequence number. A frame will be | 208 // How far frames have been cleared by sequence number. A frame will be |
| 212 // cleared if it contains a packet with a sequence number older than | 209 // cleared if it contains a packet with a sequence number older than |
| 213 // |cleared_to_seq_num_|. | 210 // |cleared_to_seq_num_|. |
| 214 int cleared_to_seq_num_ GUARDED_BY(crit_); | 211 int cleared_to_seq_num_ GUARDED_BY(crit_); |
| 215 | 212 |
| 216 OnCompleteFrameCallback* frame_callback_; | 213 OnCompleteFrameCallback* frame_callback_; |
| 214 |
| 215 // Unwrapper used to unwrap generic RTP streams. In a generic stream we derive |
| 216 // a picture id from the packet sequence number. |
| 217 SeqNumUnwrapper<uint16_t> generic_unwrapper_ GUARDED_BY(crit_); |
| 218 |
| 219 // Unwrapper used to unwrap VP8/VP9 streams which have their picture id |
| 220 // specified. |
| 221 SeqNumUnwrapper<uint16_t, kPicIdLength> unwrapper_ GUARDED_BY(crit_); |
| 217 }; | 222 }; |
| 218 | 223 |
| 219 } // namespace video_coding | 224 } // namespace video_coding |
| 220 } // namespace webrtc | 225 } // namespace webrtc |
| 221 | 226 |
| 222 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ | 227 #endif // WEBRTC_MODULES_VIDEO_CODING_RTP_FRAME_REFERENCE_FINDER_H_ |
| OLD | NEW |