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 | 15 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmb_item.h" |
16 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 16 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
17 #include "webrtc/typedefs.h" | 17 #include "webrtc/typedefs.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 class TMMBRSet | 20 class TMMBRSet : public std::vector<rtcp::TmmbItem> |
21 { | 21 { |
22 public: | 22 public: |
23 TMMBRSet(); | 23 TMMBRSet(); |
24 ~TMMBRSet(); | 24 ~TMMBRSet(); |
25 | 25 |
26 void VerifyAndAllocateSet(uint32_t minimumSize); | 26 void VerifyAndAllocateSet(uint32_t minimumSize); |
27 void VerifyAndAllocateSetKeepingData(uint32_t minimumSize); | 27 void VerifyAndAllocateSetKeepingData(uint32_t minimumSize); |
28 // Number of valid data items in set. | 28 // Number of valid data items in set. |
29 uint32_t lengthOfSet() const { return _lengthOfSet; } | 29 uint32_t lengthOfSet() const { return _lengthOfSet; } |
30 // Presently allocated max size of set. | 30 // Presently allocated max size of set. |
31 uint32_t sizeOfSet() const { return _sizeOfSet; } | 31 uint32_t sizeOfSet() const { return size(); } |
philipel
2016/02/23 13:46:39
Maybe remove this function since you inherit the p
danilchap
2016/02/23 14:39:47
Would rather do it in other CL: removing this func
| |
32 void clearSet() { | 32 void clearSet() { |
33 _lengthOfSet = 0; | 33 _lengthOfSet = 0; |
34 } | 34 } |
35 uint32_t Tmmbr(int i) const { | 35 uint32_t Tmmbr(int i) const { |
36 return _data.at(i).tmmbr; | 36 return at(i).bitrate_bps() / 1000; |
philipel
2016/02/23 13:46:39
Replace at() with operator[] since at() does bound
danilchap
2016/02/23 14:39:47
Done.
| |
37 } | 37 } |
38 uint32_t PacketOH(int i) const { | 38 uint32_t PacketOH(int i) const { |
39 return _data.at(i).packet_oh; | 39 return at(i).packet_overhead(); |
40 } | 40 } |
41 uint32_t Ssrc(int i) const { | 41 uint32_t Ssrc(int i) const { |
42 return _data.at(i).ssrc; | 42 return at(i).ssrc(); |
43 } | 43 } |
44 void SetEntry(unsigned int i, | 44 void SetEntry(unsigned int i, |
45 uint32_t tmmbrSet, | 45 uint32_t tmmbrSet, |
46 uint32_t packetOHSet, | 46 uint32_t packetOHSet, |
47 uint32_t ssrcSet); | 47 uint32_t ssrcSet); |
48 | 48 |
49 void AddEntry(uint32_t tmmbrSet, | 49 void AddEntry(uint32_t tmmbrSet, |
50 uint32_t packetOHSet, | 50 uint32_t packetOHSet, |
51 uint32_t ssrcSet); | 51 uint32_t ssrcSet); |
52 | 52 |
53 // Remove one entry from table, and move all others down. | 53 // Remove one entry from table, and move all others down. |
54 void RemoveEntry(uint32_t sourceIdx); | 54 void RemoveEntry(uint32_t sourceIdx); |
55 | 55 |
56 void SwapEntries(uint32_t firstIdx, | 56 void SwapEntries(uint32_t firstIdx, |
57 uint32_t secondIdx); | 57 uint32_t secondIdx); |
58 | 58 |
59 // Set entry data to zero, but keep it in table. | 59 // Set entry data to zero, but keep it in table. |
60 void ClearEntry(uint32_t idx); | 60 void ClearEntry(uint32_t idx); |
61 | 61 |
62 private: | 62 private: |
63 class SetElement { | |
64 public: | |
65 SetElement() : tmmbr(0), packet_oh(0), ssrc(0) {} | |
66 uint32_t tmmbr; | |
67 uint32_t packet_oh; | |
68 uint32_t ssrc; | |
69 }; | |
70 | |
71 std::vector<SetElement> _data; | |
72 // Number of places allocated. | |
73 uint32_t _sizeOfSet; | |
74 // NUmber of places currently in use. | 63 // NUmber of places currently in use. |
75 uint32_t _lengthOfSet; | 64 uint32_t _lengthOfSet; |
76 }; | 65 }; |
77 | 66 |
78 class TMMBRHelp | 67 class TMMBRHelp |
79 { | 68 { |
80 public: | 69 public: |
81 TMMBRHelp(); | 70 TMMBRHelp(); |
82 virtual ~TMMBRHelp(); | 71 virtual ~TMMBRHelp(); |
83 | 72 |
(...skipping 22 matching lines...) Expand all Loading... | |
106 TMMBRSet _candidateSet; | 95 TMMBRSet _candidateSet; |
107 TMMBRSet _boundingSet; | 96 TMMBRSet _boundingSet; |
108 TMMBRSet _boundingSetToSend; | 97 TMMBRSet _boundingSetToSend; |
109 | 98 |
110 float* _ptrIntersectionBoundingSet; | 99 float* _ptrIntersectionBoundingSet; |
111 float* _ptrMaxPRBoundingSet; | 100 float* _ptrMaxPRBoundingSet; |
112 }; | 101 }; |
113 } // namespace webrtc | 102 } // namespace webrtc |
114 | 103 |
115 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ | 104 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ |
OLD | NEW |