OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
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_VIDEO_ENGINE_VIE_REMB_H_ | |
12 #define WEBRTC_VIDEO_ENGINE_VIE_REMB_H_ | |
13 | |
14 #include <list> | |
15 #include <utility> | |
16 #include <vector> | |
17 | |
18 #include "webrtc/base/scoped_ptr.h" | |
19 #include "webrtc/modules/include/module.h" | |
20 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | |
22 | |
23 namespace webrtc { | |
24 | |
25 class CriticalSectionWrapper; | |
26 class ProcessThread; | |
27 class RtpRtcp; | |
28 | |
29 class VieRemb : public RemoteBitrateObserver { | |
30 public: | |
31 explicit VieRemb(Clock* clock); | |
32 ~VieRemb(); | |
33 | |
34 // Called to add a receive channel to include in the REMB packet. | |
35 void AddReceiveChannel(RtpRtcp* rtp_rtcp); | |
36 | |
37 // Removes the specified channel from REMB estimate. | |
38 void RemoveReceiveChannel(RtpRtcp* rtp_rtcp); | |
39 | |
40 // Called to add a module that can generate and send REMB RTCP. | |
41 void AddRembSender(RtpRtcp* rtp_rtcp); | |
42 | |
43 // Removes a REMB RTCP sender. | |
44 void RemoveRembSender(RtpRtcp* rtp_rtcp); | |
45 | |
46 // Returns true if the instance is in use, false otherwise. | |
47 bool InUse() const; | |
48 | |
49 // Called every time there is a new bitrate estimate for a receive channel | |
50 // group. This call will trigger a new RTCP REMB packet if the bitrate | |
51 // estimate has decreased or if no RTCP REMB packet has been sent for | |
52 // a certain time interval. | |
53 // Implements RtpReceiveBitrateUpdate. | |
54 virtual void OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs, | |
55 unsigned int bitrate); | |
56 | |
57 private: | |
58 typedef std::list<RtpRtcp*> RtpModules; | |
59 | |
60 Clock* const clock_; | |
61 rtc::scoped_ptr<CriticalSectionWrapper> list_crit_; | |
62 | |
63 // The last time a REMB was sent. | |
64 int64_t last_remb_time_; | |
65 unsigned int last_send_bitrate_; | |
66 | |
67 // All RtpRtcp modules to include in the REMB packet. | |
68 RtpModules receive_modules_; | |
69 | |
70 // All modules that can send REMB RTCP. | |
71 RtpModules rtcp_sender_; | |
72 | |
73 // The last bitrate update. | |
74 unsigned int bitrate_; | |
75 }; | |
76 | |
77 } // namespace webrtc | |
78 | |
79 #endif // WEBRTC_VIDEO_ENGINE_VIE_REMB_H_ | |
OLD | NEW |