summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/modules/video_coding/rtp_frame_id_only_ref_finder.cc
blob: 9f3d5bb296b9aa51b9bf5e04dc1fb5ef217529f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 *  Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#include "modules/video_coding/rtp_frame_id_only_ref_finder.h"

#include <utility>

#include "rtc_base/logging.h"

namespace webrtc {

RtpFrameReferenceFinder::ReturnVector RtpFrameIdOnlyRefFinder::ManageFrame(
    std::unique_ptr<RtpFrameObject> frame,
    int frame_id) {
  frame->SetSpatialIndex(0);
  frame->SetId(unwrapper_.Unwrap(frame_id & (kFrameIdLength - 1)));
  frame->num_references =
      frame->frame_type() == VideoFrameType::kVideoFrameKey ? 0 : 1;
  frame->references[0] = frame->Id() - 1;

  RtpFrameReferenceFinder::ReturnVector res;
  res.push_back(std::move(frame));
  return res;
}

}  // namespace webrtc