OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ | 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ |
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ | 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" | 15 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" |
16 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 class TMMBRSet : public std::vector<rtcp::TmmbItem> { | |
20 public: | |
21 void VerifyAndAllocateSet(uint32_t minimumSize); | |
22 void VerifyAndAllocateSetKeepingData(uint32_t minimumSize); | |
23 // Number of valid data items in set. | |
24 uint32_t lengthOfSet() const { return size(); } | |
25 // Presently allocated max size of set. | |
26 uint32_t sizeOfSet() const { return capacity(); } | |
27 void clearSet() { clear(); } | |
28 uint32_t Tmmbr(int i) const { return (*this)[i].bitrate_bps() / 1000; } | |
29 uint32_t PacketOH(int i) const { return (*this)[i].packet_overhead(); } | |
30 uint32_t Ssrc(int i) const { return (*this)[i].ssrc(); } | |
31 void SetEntry(unsigned int i, | |
32 uint32_t tmmbrSet, | |
33 uint32_t packetOHSet, | |
34 uint32_t ssrcSet); | |
35 | |
36 void AddEntry(uint32_t tmmbrSet, uint32_t packetOHSet, uint32_t ssrcSet); | |
37 | |
38 // Remove one entry from table, and move all others down. | |
39 void RemoveEntry(uint32_t sourceIdx); | |
40 }; | |
41 | 19 |
42 class TMMBRHelp { | 20 class TMMBRHelp { |
43 public: | 21 public: |
44 static std::vector<rtcp::TmmbItem> FindBoundingSet( | 22 static std::vector<rtcp::TmmbItem> FindBoundingSet( |
45 std::vector<rtcp::TmmbItem> candidates); | 23 std::vector<rtcp::TmmbItem> candidates); |
46 | 24 |
47 static bool IsOwner(const std::vector<rtcp::TmmbItem>& bounding, | 25 static bool IsOwner(const std::vector<rtcp::TmmbItem>& bounding, |
48 uint32_t ssrc); | 26 uint32_t ssrc); |
49 | 27 |
50 static uint64_t CalcMinBitrateBps( | 28 static uint64_t CalcMinBitrateBps( |
51 const std::vector<rtcp::TmmbItem>& candidates); | 29 const std::vector<rtcp::TmmbItem>& candidates); |
52 }; | 30 }; |
53 } // namespace webrtc | 31 } // namespace webrtc |
54 | 32 |
55 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ | 33 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ |
OLD | NEW |