| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 BitrateController* bitrate_controller, | 30 BitrateController* bitrate_controller, |
| 31 Clock* clock, | 31 Clock* clock) |
| 32 ProcessThread* process_thread) | |
| 33 : send_time_history_(clock, kSendTimeHistoryWindowMs), | 32 : send_time_history_(clock, kSendTimeHistoryWindowMs), |
| 34 bitrate_controller_(bitrate_controller), | 33 bitrate_controller_(bitrate_controller), |
| 35 process_thread_(process_thread), | |
| 36 clock_(clock), | 34 clock_(clock), |
| 37 current_offset_ms_(kNoTimestamp), | 35 current_offset_ms_(kNoTimestamp), |
| 38 last_timestamp_us_(kNoTimestamp) {} | 36 last_timestamp_us_(kNoTimestamp) {} |
| 39 | 37 |
| 40 TransportFeedbackAdapter::~TransportFeedbackAdapter() { | 38 TransportFeedbackAdapter::~TransportFeedbackAdapter() { |
| 41 if (bitrate_estimator_.get()) | |
| 42 process_thread_->DeRegisterModule(bitrate_estimator_.get()); | |
| 43 } | 39 } |
| 44 | 40 |
| 45 void TransportFeedbackAdapter::SetBitrateEstimator( | 41 void TransportFeedbackAdapter::SetBitrateEstimator( |
| 46 RemoteBitrateEstimator* rbe) { | 42 RemoteBitrateEstimator* rbe) { |
| 47 if (bitrate_estimator_.get() != rbe) { | 43 if (bitrate_estimator_.get() != rbe) { |
| 48 bitrate_estimator_.reset(rbe); | 44 bitrate_estimator_.reset(rbe); |
| 49 process_thread_->RegisterModule(rbe); | |
| 50 } | 45 } |
| 51 } | 46 } |
| 52 | 47 |
| 53 void TransportFeedbackAdapter::AddPacket(uint16_t sequence_number, | 48 void TransportFeedbackAdapter::AddPacket(uint16_t sequence_number, |
| 54 size_t length, | 49 size_t length, |
| 55 bool was_paced) { | 50 bool was_paced) { |
| 56 rtc::CritScope cs(&lock_); | 51 rtc::CritScope cs(&lock_); |
| 57 send_time_history_.AddAndRemoveOld(sequence_number, length, was_paced); | 52 send_time_history_.AddAndRemoveOld(sequence_number, length, was_paced); |
| 58 } | 53 } |
| 59 | 54 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); | 122 bitrate_controller_->UpdateDelayBasedEstimate(bitrate); |
| 128 } | 123 } |
| 129 | 124 |
| 130 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, | 125 void TransportFeedbackAdapter::OnRttUpdate(int64_t avg_rtt_ms, |
| 131 int64_t max_rtt_ms) { | 126 int64_t max_rtt_ms) { |
| 132 RTC_DCHECK(bitrate_estimator_.get() != nullptr); | 127 RTC_DCHECK(bitrate_estimator_.get() != nullptr); |
| 133 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); | 128 bitrate_estimator_->OnRttUpdate(avg_rtt_ms, max_rtt_ms); |
| 134 } | 129 } |
| 135 | 130 |
| 136 } // namespace webrtc | 131 } // namespace webrtc |
| OLD | NEW |