blob: b0fb69f499eac85ea8b9a202c0778d42ea3e5f7d [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.org20f44402012-03-30 11:40:15 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
22namespace webrtc {
23class TMMBRSet
24{
25public:
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
38class TMMBRHelp
39{
40public:
pwestin@webrtc.org20f44402012-03-30 11:40:15 +000041 TMMBRHelp();
niklase@google.com470e71d2011-07-07 08:21:25 +000042 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.org20f44402012-03-30 11:40:15 +000050 WebRtc_Word32 SetTMMBRBoundingSetToSend(
51 const TMMBRSet* boundingSetToSend,
52 const WebRtc_UWord32 maxBitrateKbit);
niklase@google.com470e71d2011-07-07 08:21:25 +000053
pwestin@webrtc.org20f44402012-03-30 11:40:15 +000054 bool IsOwner(const WebRtc_UWord32 ssrc, const WebRtc_UWord32 length) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000055
pwestin@webrtc.org20f44402012-03-30 11:40:15 +000056 WebRtc_Word32 CalcMinBitRate(const WebRtc_UWord32 lengthOfBoundingSet,
57 WebRtc_UWord32* minBitrateKbit) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000058
59protected:
60 TMMBRSet* VerifyAndAllocateBoundingSet(WebRtc_UWord32 minimumSize);
61 WebRtc_Word32 VerifyAndAllocateBoundingSetToSend(WebRtc_UWord32 minimumSize);
62
63 WebRtc_Word32 FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidateSet);
64
65private:
henrike@webrtc.org65573f22011-12-13 19:17:27 +000066 CriticalSectionWrapper* _criticalSection;
niklase@google.com470e71d2011-07-07 08:21:25 +000067 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_