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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 frame->num_references = 1; | 284 frame->num_references = 1; |
285 frame->references[0] = layer_info_it->second[0]; | 285 frame->references[0] = layer_info_it->second[0]; |
286 | 286 |
287 CompletedFrameVp8(std::move(frame)); | 287 CompletedFrameVp8(std::move(frame)); |
288 return; | 288 return; |
289 } | 289 } |
290 | 290 |
291 // Find all references for this frame. | 291 // Find all references for this frame. |
292 frame->num_references = 0; | 292 frame->num_references = 0; |
293 for (uint8_t layer = 0; layer <= codec_header.temporalIdx; ++layer) { | 293 for (uint8_t layer = 0; layer <= codec_header.temporalIdx; ++layer) { |
294 RTC_DCHECK_NE(-1, layer_info_it->second[layer]); | 294 // If we have not yet received a previous frame on this temporal layer, |
| 295 // stash this frame. |
| 296 if (layer_info_it->second[layer] == -1) { |
| 297 stashed_frames_.push_back(std::move(frame)); |
| 298 return; |
| 299 } |
295 | 300 |
296 // If we have not yet received a frame between this frame and the referenced | 301 // If we have not yet received a frame between this frame and the referenced |
297 // frame then we have to wait for that frame to be completed first. | 302 // frame then we have to wait for that frame to be completed first. |
298 auto not_received_frame_it = | 303 auto not_received_frame_it = |
299 not_yet_received_frames_.upper_bound(layer_info_it->second[layer]); | 304 not_yet_received_frames_.upper_bound(layer_info_it->second[layer]); |
300 if (not_received_frame_it != not_yet_received_frames_.end() && | 305 if (not_received_frame_it != not_yet_received_frames_.end() && |
301 AheadOf<uint16_t, kPicIdLength>(frame->picture_id, | 306 AheadOf<uint16_t, kPicIdLength>(frame->picture_id, |
302 *not_received_frame_it)) { | 307 *not_received_frame_it)) { |
303 stashed_frames_.push_back(std::move(frame)); | 308 stashed_frames_.push_back(std::move(frame)); |
304 return; | 309 return; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 if (AheadOf<uint16_t, kPicIdLength>(picture_id, unwrap_truncated)) | 569 if (AheadOf<uint16_t, kPicIdLength>(picture_id, unwrap_truncated)) |
565 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff); | 570 last_unwrap_ = Add<1 << 16>(last_unwrap_, diff); |
566 else | 571 else |
567 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff); | 572 last_unwrap_ = Subtract<1 << 16>(last_unwrap_, diff); |
568 | 573 |
569 return last_unwrap_; | 574 return last_unwrap_; |
570 } | 575 } |
571 | 576 |
572 } // namespace video_coding | 577 } // namespace video_coding |
573 } // namespace webrtc | 578 } // namespace webrtc |
OLD | NEW |