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 #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" | 11 #include "webrtc/modules/remote_bitrate_estimator/transport_feedback_adapter.h" |
12 | 12 |
13 #include <limits> | 13 #include <limits> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/logging.h" | 16 #include "webrtc/base/logging.h" |
17 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s
end_time.h" | 17 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_s
end_time.h" |
18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
19 #include "webrtc/modules/utility/include/process_thread.h" | 19 #include "webrtc/modules/utility/include/process_thread.h" |
20 | 20 |
21 namespace webrtc { | 21 namespace webrtc { |
22 | 22 |
23 const int64_t kNoTimestamp = -1; | 23 const int64_t kNoTimestamp = -1; |
24 const int64_t kSendTimeHistoryWindowMs = 10000; | 24 const int64_t kSendTimeHistoryWindowMs = 10000; |
25 const int64_t kBaseTimestampScaleFactor = | 25 const int64_t kBaseTimestampScaleFactor = |
26 rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8); | 26 rtcp::TransportFeedback::kDeltaScaleFactor * (1 << 8); |
27 const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24); | 27 const int64_t kBaseTimestampRangeSizeUs = kBaseTimestampScaleFactor * (1 << 24); |
28 | 28 |
29 TransportFeedbackAdapter::TransportFeedbackAdapter( | 29 TransportFeedbackAdapter::TransportFeedbackAdapter( |
30 RtcpBandwidthObserver* bandwidth_observer, | 30 BitrateController* bitrate_controller, |
31 Clock* clock, | 31 Clock* clock, |
32 ProcessThread* process_thread) | 32 ProcessThread* process_thread) |
33 : send_time_history_(clock, kSendTimeHistoryWindowMs), | 33 : send_time_history_(clock, kSendTimeHistoryWindowMs), |
34 rtcp_bandwidth_observer_(bandwidth_observer), | 34 bitrate_controller_(bitrate_controller), |
35 process_thread_(process_thread), | 35 process_thread_(process_thread), |
36 clock_(clock), | 36 clock_(clock), |
37 current_offset_ms_(kNoTimestamp), | 37 current_offset_ms_(kNoTimestamp), |
38 last_timestamp_us_(kNoTimestamp) {} | 38 last_timestamp_us_(kNoTimestamp) {} |
39 | 39 |
40 TransportFeedbackAdapter::~TransportFeedbackAdapter() { | 40 TransportFeedbackAdapter::~TransportFeedbackAdapter() { |
41 if (bitrate_estimator_.get()) | 41 if (bitrate_estimator_.get()) |
42 process_thread_->DeRegisterModule(bitrate_estimator_.get()); | 42 process_thread_->DeRegisterModule(bitrate_estimator_.get()); |
43 } | 43 } |
44 | 44 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 120 RTC_DCHECK(bitrate_estimator_.get() != nullptr); |
121 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector); | 121 bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector); |
122 } | 122 } |
123 | 123 |
124 void TransportFeedbackAdapter::OnReceiveBitrateChanged( | 124 void TransportFeedbackAdapter::OnReceiveBitrateChanged( |
125 const std::vector<unsigned int>& ssrcs, | 125 const std::vector<unsigned int>& ssrcs, |
126 unsigned int bitrate) { | 126 unsigned int bitrate) { |
127 rtcp_bandwidth_observer_->OnReceivedEstimatedBitrate(bitrate); | 127 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); |
128 } | 128 } |
129 | 129 |
130 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, | 130 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, |
131 int64_t max_rtt_ms) { | 131 int64_t max_rtt_ms) { |
132 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 132 RTC_DCHECK(bitrate_estimator_.get() != nullptr); |
133 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); | 133 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
134 } | 134 } |
135 | 135 |
136 } // namespace webrtc | 136 } // namespace webrtc |
OLD | NEW |