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_TRANSPORT_FEEDBACK_ADAPTER_H_ | 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ |
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TRANSPORT_FEEDBACK_ADAPTER_H_ | 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/criticalsection.h" | 17 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/thread_annotations.h" | 18 #include "webrtc/base/thread_annotations.h" |
| 19 #include "webrtc/base/thread_checker.h" |
| 20 #include "webrtc/modules/congestion_controller/delay_based_bwe.h" |
19 #include "webrtc/modules/include/module_common_types.h" | 21 #include "webrtc/modules/include/module_common_types.h" |
20 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | |
21 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
| 26 class BitrateController; |
25 class ProcessThread; | 27 class ProcessThread; |
26 | 28 |
27 class TransportFeedbackAdapter : public TransportFeedbackObserver, | 29 class TransportFeedbackAdapter : public TransportFeedbackObserver, |
28 public CallStatsObserver { | 30 public CallStatsObserver { |
29 public: | 31 public: |
30 explicit TransportFeedbackAdapter(Clock* clock); | 32 TransportFeedbackAdapter(Clock* clock, BitrateController* bitrate_controller); |
31 virtual ~TransportFeedbackAdapter(); | 33 virtual ~TransportFeedbackAdapter(); |
32 | 34 |
33 void SetBitrateEstimator(RemoteBitrateEstimator* rbe); | 35 void InitBwe(); |
34 RemoteBitrateEstimator* GetBitrateEstimator() const { | |
35 return bitrate_estimator_.get(); | |
36 } | |
37 | |
38 // Implements TransportFeedbackObserver. | 36 // Implements TransportFeedbackObserver. |
39 void AddPacket(uint16_t sequence_number, | 37 void AddPacket(uint16_t sequence_number, |
40 size_t length, | 38 size_t length, |
41 int probe_cluster_id) override; | 39 int probe_cluster_id) override; |
42 void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); | 40 void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); |
43 | 41 |
| 42 // TODO(holmer): This method should return DelayBasedBwe::Result so that we |
| 43 // can get rid of the dependency on BitrateController. Requires changes |
| 44 // to the CongestionController interface. |
44 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; | 45 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; |
45 std::vector<PacketInfo> GetTransportFeedbackVector() const override; | 46 std::vector<PacketInfo> GetTransportFeedbackVector() const override; |
46 | 47 |
47 // Implements CallStatsObserver. | 48 // Implements CallStatsObserver. |
48 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | 49 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; |
49 | 50 |
| 51 void SetMinBitrate(int min_bitrate_bps); |
| 52 |
50 private: | 53 private: |
51 std::vector<PacketInfo> GetPacketFeedbackVector( | 54 std::vector<PacketInfo> GetPacketFeedbackVector( |
52 const rtcp::TransportFeedback& feedback); | 55 const rtcp::TransportFeedback& feedback); |
53 | 56 |
54 rtc::CriticalSection lock_; | 57 rtc::CriticalSection lock_; |
| 58 rtc::CriticalSection bwe_lock_; |
55 SendTimeHistory send_time_history_ GUARDED_BY(&lock_); | 59 SendTimeHistory send_time_history_ GUARDED_BY(&lock_); |
56 std::unique_ptr<RemoteBitrateEstimator> bitrate_estimator_; | 60 std::unique_ptr<DelayBasedBwe> delay_based_bwe_ GUARDED_BY(&bwe_lock_); |
57 Clock* const clock_; | 61 Clock* const clock_; |
58 int64_t current_offset_ms_; | 62 int64_t current_offset_ms_; |
59 int64_t last_timestamp_us_; | 63 int64_t last_timestamp_us_; |
| 64 BitrateController* const bitrate_controller_; |
60 std::vector<PacketInfo> last_packet_feedback_vector_; | 65 std::vector<PacketInfo> last_packet_feedback_vector_; |
61 }; | 66 }; |
62 | 67 |
63 } // namespace webrtc | 68 } // namespace webrtc |
64 | 69 |
65 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TRANSPORT_FEEDBACK_ADAPTER_H_ | 70 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ |
OLD | NEW |