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_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ | 11 #ifndef WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ |
12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ | 12 #define WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ |
13 | 13 |
14 #include <memory> | |
15 #include <vector> | 14 #include <vector> |
16 | 15 |
17 #include "webrtc/base/criticalsection.h" | 16 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/thread_annotations.h" | 17 #include "webrtc/base/thread_annotations.h" |
19 #include "webrtc/base/thread_checker.h" | 18 #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" | 19 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" |
23 | 20 |
24 namespace webrtc { | 21 namespace webrtc { |
25 | 22 |
26 class BitrateController; | 23 namespace rtcp { |
27 class RtcEventLog; | 24 class TransportFeedback; |
28 class ProcessThread; | 25 } // namespace rtcp |
29 | 26 |
30 class TransportFeedbackAdapter : public TransportFeedbackObserver, | 27 class TransportFeedbackAdapter { |
31 public CallStatsObserver { | |
32 public: | 28 public: |
33 TransportFeedbackAdapter(RtcEventLog* event_log, | 29 TransportFeedbackAdapter(Clock* clock); |
34 Clock* clock, | |
35 BitrateController* bitrate_controller); | |
36 virtual ~TransportFeedbackAdapter(); | 30 virtual ~TransportFeedbackAdapter(); |
37 | 31 |
38 void InitBwe(); | |
39 // Implements TransportFeedbackObserver. | |
40 void AddPacket(uint16_t sequence_number, | 32 void AddPacket(uint16_t sequence_number, |
41 size_t length, | 33 size_t length, |
42 const PacedPacketInfo& pacing_info) override; | 34 const PacedPacketInfo& pacing_info); |
43 void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); | 35 void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); |
44 | 36 |
45 // TODO(holmer): This method should return DelayBasedBwe::Result so that we | 37 // TODO(holmer): This method should return DelayBasedBwe::Result so that we |
46 // can get rid of the dependency on BitrateController. Requires changes | 38 // can get rid of the dependency on BitrateController. Requires changes |
47 // to the CongestionController interface. | 39 // to the CongestionController interface. |
48 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; | 40 void OnTransportFeedback(const rtcp::TransportFeedback& feedback); |
49 std::vector<PacketFeedback> GetTransportFeedbackVector() const override; | 41 std::vector<PacketFeedback> GetTransportFeedbackVector() const; |
50 | 42 |
51 // Implements CallStatsObserver. | |
52 void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms) override; | |
53 | |
54 void SetStartBitrate(int start_bitrate_bps); | |
55 void SetMinBitrate(int min_bitrate_bps); | |
56 void SetTransportOverhead(int transport_overhead_bytes_per_packet); | 43 void SetTransportOverhead(int transport_overhead_bytes_per_packet); |
57 | 44 |
58 int64_t GetProbingIntervalMs() const; | |
59 | |
60 private: | 45 private: |
61 std::vector<PacketFeedback> GetPacketFeedbackVector( | 46 std::vector<PacketFeedback> GetPacketFeedbackVector( |
62 const rtcp::TransportFeedback& feedback); | 47 const rtcp::TransportFeedback& feedback); |
63 | 48 |
64 const bool send_side_bwe_with_overhead_; | 49 const bool send_side_bwe_with_overhead_; |
65 rtc::CriticalSection lock_; | 50 rtc::CriticalSection lock_; |
66 rtc::CriticalSection bwe_lock_; | |
67 int transport_overhead_bytes_per_packet_ GUARDED_BY(&lock_); | 51 int transport_overhead_bytes_per_packet_ GUARDED_BY(&lock_); |
68 SendTimeHistory send_time_history_ GUARDED_BY(&lock_); | 52 SendTimeHistory send_time_history_ GUARDED_BY(&lock_); |
69 std::unique_ptr<DelayBasedBwe> delay_based_bwe_ GUARDED_BY(&bwe_lock_); | |
70 RtcEventLog* const event_log_; | |
71 Clock* const clock_; | 53 Clock* const clock_; |
minyue-webrtc
2017/03/02 19:53:58
const
elad.alon_webrtc.org
2017/03/08 18:25:10
Done.
| |
72 int64_t current_offset_ms_; | 54 int64_t current_offset_ms_; |
73 int64_t last_timestamp_us_; | 55 int64_t last_timestamp_us_; |
74 BitrateController* const bitrate_controller_; | |
75 std::vector<PacketFeedback> last_packet_feedback_vector_; | 56 std::vector<PacketFeedback> last_packet_feedback_vector_; |
minyue-webrtc
2017/03/02 19:53:58
where is the list<FeedbackObserver>
elad.alon_webrtc.org
2017/03/08 18:25:10
Upcoming CL. This CL only deals with moving the BW
| |
76 | 57 |
77 // Three main threads are in play: | |
78 // | |
79 // 1. Data packetized and scheduled for transmission (AddPacket). | |
80 // 2. After socket sends the data, a notification is produced (OnSentPacket). | |
81 // The same thread is also the one on which feedbacks are | |
82 // received (OnTransportFeedback). | |
83 // 3. RTT updates, etc., received from the module process thread (CallStats). | |
84 // | |
85 // Note: Not everything falls into this division. GetProbingIntervalMs, for | |
86 // example, is called from multiple threads. | |
87 rtc::ThreadChecker packetizer_thread_checker_; | 58 rtc::ThreadChecker packetizer_thread_checker_; |
88 rtc::ThreadChecker worker_thread_checker_; | 59 rtc::ThreadChecker worker_thread_checker_; |
89 rtc::ThreadChecker module_process_thread_checker_; | |
90 }; | 60 }; |
91 | 61 |
92 } // namespace webrtc | 62 } // namespace webrtc |
93 | 63 |
94 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ | 64 #endif // WEBRTC_MODULES_CONGESTION_CONTROLLER_TRANSPORT_FEEDBACK_ADAPTER_H_ |
OLD | NEW |