OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2015 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_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ | |
12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ | |
13 | |
14 #include <memory> | |
15 #include <vector> | |
16 | |
17 #include "webrtc/base/criticalsection.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" | |
21 #include "webrtc/modules/include/module_common_types.h" | |
22 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" | |
23 | |
24 namespace webrtc { | |
25 | |
26 class BitrateController; | |
27 class ProcessThread; | |
28 | |
29 class TransportFeedbackAdapter : public TransportFeedbackObserver, | |
30 public CallStatsObserver { | |
31 public: | |
32 TransportFeedbackAdapter(Clock* clock, BitrateController* bitrate_controller); | |
33 virtual ~TransportFeedbackAdapter(); | |
34 | |
35 void InitBwe(); | |
36 // Implements TransportFeedbackObserver. | |
37 void AddPacket(uint16_t sequence_number, | |
38 size_t length, | |
39 int probe_cluster_id) override; | |
40 void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); | |
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. | |
45 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; | |
46 std::vector<PacketInfo> GetTransportFeedbackVector() const override; | |
47 | |
48 // Implements CallStatsObserver. | |
49 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | |
50 | |
51 void SetMinBitrate(int min_bitrate_bps); | |
52 | |
53 private: | |
54 std::vector<PacketInfo> GetPacketFeedbackVector( | |
55 const rtcp::TransportFeedback& feedback); | |
56 | |
57 rtc::CriticalSection lock_; | |
58 rtc::CriticalSection bwe_lock_; | |
59 SendTimeHistory send_time_history_ GUARDED_BY(&lock_); | |
60 std::unique_ptr<DelayBasedBwe> delay_based_bwe_ GUARDED_BY(&bwe_lock_); | |
61 Clock* const clock_; | |
62 int64_t current_offset_ms_; | |
63 int64_t last_timestamp_us_; | |
64 BitrateController* const bitrate_controller_; | |
65 std::vector<PacketInfo> last_packet_feedback_vector_; | |
66 }; | |
67 | |
68 } // namespace webrtc | |
69 | |
70 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ | |
OLD | NEW |