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_REMOTE_BITRATE_ESTIMATOR_TRANSPORT_FEEDBACK_ADAPTER_H_ |
12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TRANSPORT_FEEDBACK_ADAPTER_H_ | 12 #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_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/modules/bitrate_controller/include/bitrate_controller.h" | |
20 #include "webrtc/modules/include/module_common_types.h" | 19 #include "webrtc/modules/include/module_common_types.h" |
21 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
22 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" | 21 #include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" |
23 | 22 |
24 namespace webrtc { | 23 namespace webrtc { |
25 | 24 |
26 class ProcessThread; | 25 class ProcessThread; |
27 class RemoteBitrateEstimator; | |
28 | 26 |
29 class TransportFeedbackAdapter : public TransportFeedbackObserver, | 27 class TransportFeedbackAdapter : public TransportFeedbackObserver, |
30 public CallStatsObserver, | 28 public CallStatsObserver { |
31 public RemoteBitrateObserver { | |
32 public: | 29 public: |
33 TransportFeedbackAdapter(BitrateController* bitrate_controller, Clock* clock); | 30 TransportFeedbackAdapter(Clock* clock); |
34 virtual ~TransportFeedbackAdapter(); | 31 virtual ~TransportFeedbackAdapter(); |
35 | 32 |
36 void SetBitrateEstimator(RemoteBitrateEstimator* rbe); | 33 void SetBitrateEstimator(RemoteBitrateEstimator* rbe); |
37 RemoteBitrateEstimator* GetBitrateEstimator() const { | 34 RemoteBitrateEstimator* GetBitrateEstimator() const { |
38 return bitrate_estimator_.get(); | 35 return bitrate_estimator_.get(); |
39 } | 36 } |
40 | 37 |
41 // Implements TransportFeedbackObserver. | 38 // Implements TransportFeedbackObserver. |
42 void AddPacket(uint16_t sequence_number, | 39 void AddPacket(uint16_t sequence_number, |
43 size_t length, | 40 size_t length, |
44 int probe_cluster_id) override; | 41 int probe_cluster_id) override; |
45 void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); | 42 void OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); |
46 | 43 |
47 const std::vector<PacketInfo> GetPacketFeedbackVector( | 44 const std::vector<PacketInfo> GetPacketFeedbackVector( |
48 const rtcp::TransportFeedback& feedback); | 45 const rtcp::TransportFeedback& feedback); |
49 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; | 46 void OnTransportFeedback(const rtcp::TransportFeedback& feedback) override; |
50 | 47 |
51 // Implements CallStatsObserver. | 48 // Implements CallStatsObserver. |
52 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; |
53 | 50 |
54 private: | 51 private: |
55 // Implements RemoteBitrateObserver. | |
56 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, | |
57 uint32_t bitrate) override; | |
58 | |
59 rtc::CriticalSection lock_; | 52 rtc::CriticalSection lock_; |
60 SendTimeHistory send_time_history_ GUARDED_BY(&lock_); | 53 SendTimeHistory send_time_history_ GUARDED_BY(&lock_); |
61 BitrateController* bitrate_controller_; | |
62 std::unique_ptr<RemoteBitrateEstimator> bitrate_estimator_; | 54 std::unique_ptr<RemoteBitrateEstimator> bitrate_estimator_; |
63 Clock* const clock_; | 55 Clock* const clock_; |
64 int64_t current_offset_ms_; | 56 int64_t current_offset_ms_; |
65 int64_t last_timestamp_us_; | 57 int64_t last_timestamp_us_; |
66 }; | 58 }; |
67 | 59 |
68 } // namespace webrtc | 60 } // namespace webrtc |
69 | 61 |
70 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TRANSPORT_FEEDBACK_ADAPTER_H_ | 62 #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TRANSPORT_FEEDBACK_ADAPTER_H_ |
OLD | NEW |