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