OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Sync will be broken if continuity is true for layers but not for the | 159 // Sync will be broken if continuity is true for layers but not for the |
160 // other methods (PictureId and SeqNum). | 160 // other methods (PictureId and SeqNum). |
161 if (UsingPictureId(frame)) { | 161 if (UsingPictureId(frame)) { |
162 // First check for a valid tl0PicId. | 162 // First check for a valid tl0PicId. |
163 if (frame->Tl0PicId() - tl0_pic_id_ > 1) { | 163 if (frame->Tl0PicId() - tl0_pic_id_ > 1) { |
164 full_sync_ = false; | 164 full_sync_ = false; |
165 } else { | 165 } else { |
166 full_sync_ = ContinuousPictureId(frame->PictureId()); | 166 full_sync_ = ContinuousPictureId(frame->PictureId()); |
167 } | 167 } |
168 } else { | 168 } else { |
169 full_sync_ = ContinuousSeqNum(static_cast<uint16_t>( | 169 full_sync_ = |
170 frame->GetLowSeqNum())); | 170 ContinuousSeqNum(static_cast<uint16_t>(frame->GetLowSeqNum())); |
171 } | 171 } |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 bool VCMDecodingState::ContinuousFrame(const VCMFrameBuffer* frame) const { | 175 bool VCMDecodingState::ContinuousFrame(const VCMFrameBuffer* frame) const { |
176 // Check continuity based on the following hierarchy: | 176 // Check continuity based on the following hierarchy: |
177 // - Temporal layers (stop here if out of sync). | 177 // - Temporal layers (stop here if out of sync). |
178 // - Picture Id when available. | 178 // - Picture Id when available. |
179 // - Sequence numbers. | 179 // - Sequence numbers. |
180 // Return true when in initial state. | 180 // Return true when in initial state. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 } | 223 } |
224 // No wrap | 224 // No wrap |
225 return (next_picture_id == picture_id); | 225 return (next_picture_id == picture_id); |
226 } | 226 } |
227 | 227 |
228 bool VCMDecodingState::ContinuousSeqNum(uint16_t seq_num) const { | 228 bool VCMDecodingState::ContinuousSeqNum(uint16_t seq_num) const { |
229 return seq_num == static_cast<uint16_t>(sequence_num_ + 1); | 229 return seq_num == static_cast<uint16_t>(sequence_num_ + 1); |
230 } | 230 } |
231 | 231 |
232 bool VCMDecodingState::ContinuousLayer(int temporal_id, | 232 bool VCMDecodingState::ContinuousLayer(int temporal_id, int tl0_pic_id) const { |
233 int tl0_pic_id) const { | |
234 // First, check if applicable. | 233 // First, check if applicable. |
235 if (temporal_id == kNoTemporalIdx || tl0_pic_id == kNoTl0PicIdx) | 234 if (temporal_id == kNoTemporalIdx || tl0_pic_id == kNoTl0PicIdx) |
236 return false; | 235 return false; |
237 // If this is the first frame to use temporal layers, make sure we start | 236 // If this is the first frame to use temporal layers, make sure we start |
238 // from base. | 237 // from base. |
239 else if (tl0_pic_id_ == kNoTl0PicIdx && temporal_id_ == kNoTemporalIdx && | 238 else if (tl0_pic_id_ == kNoTl0PicIdx && temporal_id_ == kNoTemporalIdx && |
240 temporal_id == 0) | 239 temporal_id == 0) |
241 return true; | 240 return true; |
242 | 241 |
243 // Current implementation: Look for base layer continuity. | 242 // Current implementation: Look for base layer continuity. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // that we are not trying to reference back to a very old | 276 // that we are not trying to reference back to a very old |
278 // index, but instead are referencing a newer index. | 277 // index, but instead are referencing a newer index. |
279 uint16_t diff = | 278 uint16_t diff = |
280 index > frame_decoded_cleared_to_ | 279 index > frame_decoded_cleared_to_ |
281 ? kFrameDecodedLength - (index - frame_decoded_cleared_to_) | 280 ? kFrameDecodedLength - (index - frame_decoded_cleared_to_) |
282 : frame_decoded_cleared_to_ - index; | 281 : frame_decoded_cleared_to_ - index; |
283 return diff > kFrameDecodedLength / 2; | 282 return diff > kFrameDecodedLength / 2; |
284 } | 283 } |
285 | 284 |
286 } // namespace webrtc | 285 } // namespace webrtc |
OLD | NEW |