OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_ | 11 #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_ |
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_ | 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <memory> | |
15 #include <vector> | 16 #include <vector> |
16 | 17 |
17 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
19 #include "webrtc/base/ratetracker.h" | |
18 #include "webrtc/modules/include/module_common_types.h" | 20 #include "webrtc/modules/include/module_common_types.h" |
19 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat or.h" |
20 | 22 |
21 namespace webrtc { | 23 namespace webrtc { |
22 | 24 |
25 class BitrateController; | |
23 class Clock; | 26 class Clock; |
24 class PacketRouter; | 27 class PacketRouter; |
25 namespace rtcp { | 28 namespace rtcp { |
26 class TransportFeedback; | 29 class TransportFeedback; |
27 } | 30 } |
28 | 31 |
29 // Class used when send-side BWE is enabled: This proxy is instantiated on the | 32 // Class used when send-side BWE is enabled: This proxy is instantiated on the |
30 // receive side. It buffers a number of receive timestamps and then sends | 33 // receive side. It buffers a number of receive timestamps and then sends |
31 // transport feedback messages back too the send side. | 34 // transport feedback messages back too the send side. |
32 | 35 |
33 class RemoteEstimatorProxy : public RemoteBitrateEstimator { | 36 class RemoteEstimatorProxy : public RemoteBitrateEstimator { |
34 public: | 37 public: |
35 RemoteEstimatorProxy(Clock* clock, PacketRouter* packet_router); | 38 RemoteEstimatorProxy(Clock* clock, |
39 PacketRouter* packet_router, | |
40 BitrateController* bitrate_controller); | |
stefan-webrtc
2016/10/26 14:45:16
I'm not sure I like this dependency... We can't kn
michaelt
2016/10/27 15:15:44
But if we use bitrate received we assume that we a
stefan-webrtc
2016/10/31 08:54:36
Right, when the client is receive-only we have to
michaelt
2016/10/31 13:03:15
For this CL i would use a hard coded rate on the r
stefan-webrtc
2016/10/31 14:04:19
Constant rate for receive only and using OnBitrate
michaelt
2016/11/02 10:10:06
Done.
| |
36 virtual ~RemoteEstimatorProxy(); | 41 virtual ~RemoteEstimatorProxy(); |
37 | 42 |
38 void IncomingPacketFeedbackVector( | 43 void IncomingPacketFeedbackVector( |
39 const std::vector<PacketInfo>& packet_feedback_vector) override; | 44 const std::vector<PacketInfo>& packet_feedback_vector) override; |
40 void IncomingPacket(int64_t arrival_time_ms, | 45 void IncomingPacket(int64_t arrival_time_ms, |
41 size_t payload_size, | 46 size_t payload_size, |
42 const RTPHeader& header) override; | 47 const RTPHeader& header) override; |
43 void RemoveStream(uint32_t ssrc) override {} | 48 void RemoveStream(uint32_t ssrc) override {} |
44 bool LatestEstimate(std::vector<unsigned int>* ssrcs, | 49 bool LatestEstimate(std::vector<unsigned int>* ssrcs, |
45 unsigned int* bitrate_bps) const override; | 50 unsigned int* bitrate_bps) const override; |
46 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override {} | 51 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override {} |
47 void SetMinBitrate(int min_bitrate_bps) override {} | 52 void SetMinBitrate(int min_bitrate_bps) override {} |
48 int64_t TimeUntilNextProcess() override; | 53 int64_t TimeUntilNextProcess() override; |
49 void Process() override; | 54 void Process() override; |
50 | 55 |
51 static const int kDefaultProcessIntervalMs; | 56 static const int kMinSendIntervalMs; |
57 static const int kMaxSendIntervalMs; | |
58 static const int kMinPacketCountRecievedBitrate; | |
stefan-webrtc
2016/10/26 14:45:16
Received
michaelt
2016/10/27 15:15:44
Removed this const since its not used anymore.
| |
52 static const int kBackWindowMs; | 59 static const int kBackWindowMs; |
53 | 60 |
54 private: | 61 private: |
55 void OnPacketArrival(uint16_t sequence_number, int64_t arrival_time) | 62 void OnPacketArrival(uint16_t sequence_number, int64_t arrival_time) |
56 EXCLUSIVE_LOCKS_REQUIRED(&lock_); | 63 EXCLUSIVE_LOCKS_REQUIRED(&lock_); |
57 bool BuildFeedbackPacket(rtcp::TransportFeedback* feedback_packet); | 64 bool BuildFeedbackPacket(rtcp::TransportFeedback* feedback_packet); |
58 | 65 |
59 Clock* const clock_; | 66 Clock* const clock_; |
60 PacketRouter* const packet_router_; | 67 PacketRouter* const packet_router_; |
61 int64_t last_process_time_ms_; | 68 int64_t last_process_time_ms_; |
62 | 69 |
63 rtc::CriticalSection lock_; | 70 rtc::CriticalSection lock_; |
64 | 71 |
65 uint32_t media_ssrc_ GUARDED_BY(&lock_); | 72 uint32_t media_ssrc_ GUARDED_BY(&lock_); |
66 uint8_t feedback_sequence_ GUARDED_BY(&lock_); | 73 uint8_t feedback_sequence_ GUARDED_BY(&lock_); |
67 SequenceNumberUnwrapper unwrapper_ GUARDED_BY(&lock_); | 74 SequenceNumberUnwrapper unwrapper_ GUARDED_BY(&lock_); |
68 int64_t window_start_seq_ GUARDED_BY(&lock_); | 75 int64_t window_start_seq_ GUARDED_BY(&lock_); |
69 // Map unwrapped seq -> time. | 76 // Map unwrapped seq -> time. |
70 std::map<int64_t, int64_t> packet_arrival_times_ GUARDED_BY(&lock_); | 77 std::map<int64_t, int64_t> packet_arrival_times_ GUARDED_BY(&lock_); |
78 BitrateController* bitrate_controller_; | |
71 }; | 79 }; |
72 | 80 |
73 } // namespace webrtc | 81 } // namespace webrtc |
74 | 82 |
75 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_ | 83 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_REMOTE_ESTIMATOR_PROXY_H_ |
OLD | NEW |