blob: 6b3cd975e84dc037465d6522ff5f7065e8e3c7de [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +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.orgcac78782012-04-05 08:30:10 +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.orgcac78782012-04-05 08:30:10 +000050 WebRtc_Word32 SetTMMBRBoundingSetToSend(
51 const TMMBRSet* boundingSetToSend,
52 const WebRtc_UWord32 maxBitrateKbit);
niklase@google.com470e71d2011-07-07 08:21:25 +000053
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +000054 bool IsOwner(const WebRtc_UWord32 ssrc, const WebRtc_UWord32 length) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000055
pwestin@webrtc.orgcac78782012-04-05 08:30:10 +000056 bool CalcMinBitRate(WebRtc_UWord32* minBitrateKbit) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000057
58protected:
59 TMMBRSet* VerifyAndAllocateBoundingSet(WebRtc_UWord32 minimumSize);
60 WebRtc_Word32 VerifyAndAllocateBoundingSetToSend(WebRtc_UWord32 minimumSize);
61
62 WebRtc_Word32 FindTMMBRBoundingSet(WebRtc_Word32 numCandidates, TMMBRSet& candidateSet);
63
64private:
henrike@webrtc.org65573f22011-12-13 19:17:27 +000065 CriticalSectionWrapper* _criticalSection;
niklase@google.com470e71d2011-07-07 08:21:25 +000066 TMMBRSet _candidateSet;
67 TMMBRSet _boundingSet;
68 TMMBRSet _boundingSetToSend;
69
70 float* _ptrIntersectionBoundingSet;
71 float* _ptrMaxPRBoundingSet;
72};
73} // namespace webrtc
74
75#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_TMMBR_HELP_H_