blob: f5603e3ca9015a26ba96a757a9896cf54b666fc1 [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 {
18namespace video_coding {
19
20RtpFrameReferenceFinder::ReturnVector RtpGenericFrameRefFinder::ManageFrame(
21 std::unique_ptr<RtpFrameObject> frame,
22 const RTPVideoHeader::GenericDescriptorInfo& descriptor) {
23 // Frame IDs are unwrapped in the RtpVideoStreamReceiver, no need to unwrap
24 // them here.
25 frame->id.picture_id = descriptor.frame_id;
26 frame->SetSpatialIndex(descriptor.spatial_index);
27
28 RtpFrameReferenceFinder::ReturnVector res;
29 if (EncodedFrame::kMaxFrameReferences < descriptor.dependencies.size()) {
30 RTC_LOG(LS_WARNING) << "Too many dependencies in generic descriptor.";
31 return res;
32 }
33
34 frame->num_references = descriptor.dependencies.size();
35 for (size_t i = 0; i < descriptor.dependencies.size(); ++i) {
36 frame->references[i] = descriptor.dependencies[i];
37 }
38
39 res.push_back(std::move(frame));
40 return res;
41}
42
43} // namespace video_coding
44} // namespace webrtc