| 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 | 11 |
| 12 // Implementation of Network-Assisted Dynamic Adaptation's (NADA's) proposal. | 12 // Implementation of Network-Assisted Dynamic Adaptation's (NADA's) proposal. |
| 13 // Version according to Draft Document (mentioned in references) | 13 // Version according to Draft Document (mentioned in references) |
| 14 // http://tools.ietf.org/html/draft-zhu-rmcat-nada-06 | 14 // http://tools.ietf.org/html/draft-zhu-rmcat-nada-06 |
| 15 // From March 26, 2015. | 15 // From March 26, 2015. |
| 16 | 16 |
| 17 #include <math.h> | 17 #include <math.h> |
| 18 #include <algorithm> | 18 #include <algorithm> |
| 19 #include <vector> | 19 #include <vector> |
| 20 | 20 |
| 21 #include "webrtc/base/arraysize.h" |
| 21 #include "webrtc/base/common.h" | 22 #include "webrtc/base/common.h" |
| 22 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h" |
| 23 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 24 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
| 24 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 25 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
| 25 | 26 |
| 26 namespace webrtc { | 27 namespace webrtc { |
| 27 namespace testing { | 28 namespace testing { |
| 28 namespace bwe { | 29 namespace bwe { |
| 29 | 30 |
| 30 const int64_t NadaBweReceiver::kReceivingRateTimeWindowMs = 500; | 31 const int64_t NadaBweReceiver::kReceivingRateTimeWindowMs = 500; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 56 media_packet.payload_size(), false); | 57 media_packet.payload_size(), false); |
| 57 // Refered as x_n. | 58 // Refered as x_n. |
| 58 int64_t delay_ms = arrival_time_ms - media_packet.sender_timestamp_ms(); | 59 int64_t delay_ms = arrival_time_ms - media_packet.sender_timestamp_ms(); |
| 59 | 60 |
| 60 // The min should be updated within the first 10 minutes. | 61 // The min should be updated within the first 10 minutes. |
| 61 if (clock_.TimeInMilliseconds() < 10 * 60 * 1000) { | 62 if (clock_.TimeInMilliseconds() < 10 * 60 * 1000) { |
| 62 baseline_delay_ms_ = std::min(baseline_delay_ms_, delay_ms); | 63 baseline_delay_ms_ = std::min(baseline_delay_ms_, delay_ms); |
| 63 } | 64 } |
| 64 | 65 |
| 65 delay_signal_ms_ = delay_ms - baseline_delay_ms_; // Refered as d_n. | 66 delay_signal_ms_ = delay_ms - baseline_delay_ms_; // Refered as d_n. |
| 66 const int kMedian = ARRAY_SIZE(last_delays_ms_); | 67 const int kMedian = arraysize(last_delays_ms_); |
| 67 last_delays_ms_[(last_delays_index_++) % kMedian] = delay_signal_ms_; | 68 last_delays_ms_[(last_delays_index_++) % kMedian] = delay_signal_ms_; |
| 68 int size = std::min(last_delays_index_, kMedian); | 69 int size = std::min(last_delays_index_, kMedian); |
| 69 | 70 |
| 70 int64_t median_filtered_delay_ms_ = MedianFilter(last_delays_ms_, size); | 71 int64_t median_filtered_delay_ms_ = MedianFilter(last_delays_ms_, size); |
| 71 exp_smoothed_delay_ms_ = ExponentialSmoothingFilter( | 72 exp_smoothed_delay_ms_ = ExponentialSmoothingFilter( |
| 72 median_filtered_delay_ms_, exp_smoothed_delay_ms_, kAlpha); | 73 median_filtered_delay_ms_, exp_smoothed_delay_ms_, kAlpha); |
| 73 | 74 |
| 74 if (exp_smoothed_delay_ms_ < kDelayLowThresholdMs) { | 75 if (exp_smoothed_delay_ms_ < kDelayLowThresholdMs) { |
| 75 est_queuing_delay_signal_ms_ = exp_smoothed_delay_ms_; | 76 est_queuing_delay_signal_ms_ = exp_smoothed_delay_ms_; |
| 76 } else if (exp_smoothed_delay_ms_ < kDelayMaxThresholdMs) { | 77 } else if (exp_smoothed_delay_ms_ < kDelayMaxThresholdMs) { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 (kTheta - (bitrate_kbps_ - kMinBitrateKbps) * x_hat)) / | 279 (kTheta - (bitrate_kbps_ - kMinBitrateKbps) * x_hat)) / |
| 279 (kTauOMs * kTauOMs) + | 280 (kTauOMs * kTauOMs) + |
| 280 0.5f); | 281 0.5f); |
| 281 | 282 |
| 282 bitrate_kbps_ = bitrate_kbps_ + smoothing_factor * original_increase; | 283 bitrate_kbps_ = bitrate_kbps_ + smoothing_factor * original_increase; |
| 283 } | 284 } |
| 284 | 285 |
| 285 } // namespace bwe | 286 } // namespace bwe |
| 286 } // namespace testing | 287 } // namespace testing |
| 287 } // namespace webrtc | 288 } // namespace webrtc |
| OLD | NEW |