niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
pwestin@webrtc.org | 20f4440 | 2012-03-30 11:40:15 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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_TMMBR_HELP_H_ |
| 12 | #define WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ |
| 13 | |
| 14 | #include "typedefs.h" |
| 15 | |
| 16 | #include "critical_section_wrapper.h" |
| 17 | |
| 18 | #ifndef NULL |
| 19 | #define NULL 0 |
| 20 | #endif |
| 21 | |
| 22 | namespace webrtc { |
| 23 | class TMMBRSet |
| 24 | { |
| 25 | public: |
| 26 | TMMBRSet(); |
| 27 | ~TMMBRSet(); |
| 28 | |
| 29 | void VerifyAndAllocateSet(WebRtc_UWord32 minimumSize); |
| 30 | |
| 31 | WebRtc_UWord32* ptrTmmbrSet; |
| 32 | WebRtc_UWord32* ptrPacketOHSet; |
| 33 | WebRtc_UWord32* ptrSsrcSet; |
| 34 | WebRtc_UWord32 sizeOfSet; |
| 35 | WebRtc_UWord32 lengthOfSet; |
| 36 | }; |
| 37 | |
| 38 | class TMMBRHelp |
| 39 | { |
| 40 | public: |
pwestin@webrtc.org | 20f4440 | 2012-03-30 11:40:15 +0000 | [diff] [blame^] | 41 | TMMBRHelp(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 42 | virtual ~TMMBRHelp(); |
| 43 | |
| 44 | TMMBRSet* BoundingSet(); // used for debuging |
| 45 | TMMBRSet* CandidateSet(); |
| 46 | TMMBRSet* BoundingSetToSend(); |
| 47 | |
| 48 | TMMBRSet* VerifyAndAllocateCandidateSet(const WebRtc_UWord32 minimumSize); |
| 49 | WebRtc_Word32 FindTMMBRBoundingSet(TMMBRSet*& boundingSet); |
pwestin@webrtc.org | 20f4440 | 2012-03-30 11:40:15 +0000 | [diff] [blame^] | 50 | WebRtc_Word32 SetTMMBRBoundingSetToSend( |
| 51 | const TMMBRSet* boundingSetToSend, |
| 52 | const WebRtc_UWord32 maxBitrateKbit); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 53 | |
pwestin@webrtc.org | 20f4440 | 2012-03-30 11:40:15 +0000 | [diff] [blame^] | 54 | bool IsOwner(const WebRtc_UWord32 ssrc, const WebRtc_UWord32 length) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 55 | |
pwestin@webrtc.org | 20f4440 | 2012-03-30 11:40:15 +0000 | [diff] [blame^] | 56 | WebRtc_Word32 CalcMinBitRate(const WebRtc_UWord32 lengthOfBoundingSet, |
| 57 | WebRtc_UWord32* minBitrateKbit) const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 58 | |
| 59 | protected: |
| 60 | TMMBRSet* VerifyAndAllocateBoundingSet(WebRtc_UWord32 minimumSize); |
| 61 | WebRtc_Word32 VerifyAndAllocateBoundingSetToSend(WebRtc_UWord32 minimumSize); |
| 62 | |
| 63 | WebRtc_Word32 FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidateSet); |
| 64 | |
| 65 | private: |
henrike@webrtc.org | 65573f2 | 2011-12-13 19:17:27 +0000 | [diff] [blame] | 66 | CriticalSectionWrapper* _criticalSection; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 67 | TMMBRSet _candidateSet; |
| 68 | TMMBRSet _boundingSet; |
| 69 | TMMBRSet _boundingSetToSend; |
| 70 | |
| 71 | float* _ptrIntersectionBoundingSet; |
| 72 | float* _ptrMaxPRBoundingSet; |
| 73 | }; |
| 74 | } // namespace webrtc |
| 75 | |
| 76 | #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_ |