philipel | 4e70216 | 2020-11-27 17:56:37 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "modules/video_coding/rtp_generic_ref_finder.h" |
| 12 | |
| 13 | #include <utility> |
| 14 | |
| 15 | #include "rtc_base/logging.h" |
| 16 | |
| 17 | namespace webrtc { |
philipel | 4e70216 | 2020-11-27 17:56:37 +0100 | [diff] [blame] | 18 | |
| 19 | RtpFrameReferenceFinder::ReturnVector RtpGenericFrameRefFinder::ManageFrame( |
philipel | ca18809 | 2021-03-23 12:00:49 +0100 | [diff] [blame] | 20 | std::unique_ptr<RtpFrameObject> frame, |
philipel | 4e70216 | 2020-11-27 17:56:37 +0100 | [diff] [blame] | 21 | const RTPVideoHeader::GenericDescriptorInfo& descriptor) { |
| 22 | // Frame IDs are unwrapped in the RtpVideoStreamReceiver, no need to unwrap |
| 23 | // them here. |
philipel | 9aa9b8d | 2021-02-15 13:31:29 +0100 | [diff] [blame] | 24 | frame->SetId(descriptor.frame_id); |
philipel | 4e70216 | 2020-11-27 17:56:37 +0100 | [diff] [blame] | 25 | frame->SetSpatialIndex(descriptor.spatial_index); |
| 26 | |
| 27 | RtpFrameReferenceFinder::ReturnVector res; |
philipel | ca18809 | 2021-03-23 12:00:49 +0100 | [diff] [blame] | 28 | if (EncodedFrame::kMaxFrameReferences < descriptor.dependencies.size()) { |
philipel | 4e70216 | 2020-11-27 17:56:37 +0100 | [diff] [blame] | 29 | RTC_LOG(LS_WARNING) << "Too many dependencies in generic descriptor."; |
| 30 | return res; |
| 31 | } |
| 32 | |
| 33 | frame->num_references = descriptor.dependencies.size(); |
| 34 | for (size_t i = 0; i < descriptor.dependencies.size(); ++i) { |
| 35 | frame->references[i] = descriptor.dependencies[i]; |
| 36 | } |
| 37 | |
| 38 | res.push_back(std::move(frame)); |
| 39 | return res; |
| 40 | } |
| 41 | |
philipel | 4e70216 | 2020-11-27 17:56:37 +0100 | [diff] [blame] | 42 | } // namespace webrtc |