blob: 87fff9c26f76f3d7aebdede24a6f5e1abbaf8941 [file] [log] [blame]
philipel4e702162020-11-27 17:56:37 +01001/*
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
17namespace webrtc {
philipel4e702162020-11-27 17:56:37 +010018
19RtpFrameReferenceFinder::ReturnVector RtpGenericFrameRefFinder::ManageFrame(
philipelca188092021-03-23 12:00:49 +010020 std::unique_ptr<RtpFrameObject> frame,
philipel4e702162020-11-27 17:56:37 +010021 const RTPVideoHeader::GenericDescriptorInfo& descriptor) {
22 // Frame IDs are unwrapped in the RtpVideoStreamReceiver, no need to unwrap
23 // them here.
philipel9aa9b8d2021-02-15 13:31:29 +010024 frame->SetId(descriptor.frame_id);
philipel4e702162020-11-27 17:56:37 +010025 frame->SetSpatialIndex(descriptor.spatial_index);
26
27 RtpFrameReferenceFinder::ReturnVector res;
philipelca188092021-03-23 12:00:49 +010028 if (EncodedFrame::kMaxFrameReferences < descriptor.dependencies.size()) {
philipel4e702162020-11-27 17:56:37 +010029 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
philipel4e702162020-11-27 17:56:37 +010042} // namespace webrtc