• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2016 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 MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TARGET_BITRATE_H_
12 #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TARGET_BITRATE_H_
13 
14 #include <stddef.h>
15 #include <stdint.h>
16 
17 #include <vector>
18 
19 namespace webrtc {
20 namespace rtcp {
21 
22 class TargetBitrate {
23  public:
24   // TODO(sprang): This block type is just a place holder. We need to get an
25   //               id assigned by IANA.
26   static constexpr uint8_t kBlockType = 42;
27   static const size_t kBitrateItemSizeBytes;
28 
29   struct BitrateItem {
30     BitrateItem();
31     BitrateItem(uint8_t spatial_layer,
32                 uint8_t temporal_layer,
33                 uint32_t target_bitrate_kbps);
34 
35     uint8_t spatial_layer;
36     uint8_t temporal_layer;
37     uint32_t target_bitrate_kbps;
38   };
39 
40   TargetBitrate();
41   TargetBitrate(const TargetBitrate&);
42   TargetBitrate& operator=(const TargetBitrate&);
43   ~TargetBitrate();
44 
45   void AddTargetBitrate(uint8_t spatial_layer,
46                         uint8_t temporal_layer,
47                         uint32_t target_bitrate_kbps);
48 
49   const std::vector<BitrateItem>& GetTargetBitrates() const;
50 
51   void Parse(const uint8_t* block, uint16_t block_length);
52 
53   size_t BlockLength() const;
54 
55   void Create(uint8_t* buffer) const;
56 
57  private:
58   std::vector<BitrateItem> bitrates_;
59 };
60 
61 }  // namespace rtcp
62 }  // namespace webrtc
63 #endif  // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_TARGET_BITRATE_H_
64