• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2019 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 #ifndef COMMON_VIDEO_GENERIC_FRAME_DESCRIPTOR_GENERIC_FRAME_INFO_H_
12 #define COMMON_VIDEO_GENERIC_FRAME_DESCRIPTOR_GENERIC_FRAME_INFO_H_
13 
14 #include <bitset>
15 #include <initializer_list>
16 #include <vector>
17 
18 #include "absl/container/inlined_vector.h"
19 #include "absl/strings/string_view.h"
20 #include "api/transport/rtp/dependency_descriptor.h"
21 #include "api/video/video_codec_constants.h"
22 
23 namespace webrtc {
24 
25 // Describes how a certain encoder buffer was used when encoding a frame.
26 struct CodecBufferUsage {
CodecBufferUsageCodecBufferUsage27   constexpr CodecBufferUsage(int id, bool referenced, bool updated)
28       : id(id), referenced(referenced), updated(updated) {}
29 
30   int id = 0;
31   bool referenced = false;
32   bool updated = false;
33 };
34 
35 struct GenericFrameInfo : public FrameDependencyTemplate {
36   class Builder;
37 
38   GenericFrameInfo();
39   GenericFrameInfo(const GenericFrameInfo&);
40   ~GenericFrameInfo();
41 
42   absl::InlinedVector<CodecBufferUsage, kMaxEncoderBuffers> encoder_buffers;
43   std::vector<bool> part_of_chain;
44   std::bitset<32> active_decode_targets = ~uint32_t{0};
45 };
46 
47 class GenericFrameInfo::Builder {
48  public:
49   Builder();
50   ~Builder();
51 
52   GenericFrameInfo Build() const;
53   Builder& T(int temporal_id);
54   Builder& S(int spatial_id);
55   Builder& Dtis(absl::string_view indication_symbols);
56 
57  private:
58   GenericFrameInfo info_;
59 };
60 
61 }  // namespace webrtc
62 
63 #endif  // COMMON_VIDEO_GENERIC_FRAME_DESCRIPTOR_GENERIC_FRAME_INFO_H_
64