OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 estimator_(), | 87 estimator_(), |
88 detector_(), | 88 detector_(), |
89 incoming_bitrate_(kBitrateWindowMs, 8000), | 89 incoming_bitrate_(kBitrateWindowMs, 8000), |
90 incoming_bitrate_initialized_(false), | 90 incoming_bitrate_initialized_(false), |
91 total_probes_received_(0), | 91 total_probes_received_(0), |
92 first_packet_time_ms_(-1), | 92 first_packet_time_ms_(-1), |
93 last_update_ms_(-1), | 93 last_update_ms_(-1), |
94 uma_recorded_(false) { | 94 uma_recorded_(false) { |
95 RTC_DCHECK(observer_); | 95 RTC_DCHECK(observer_); |
96 LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; | 96 LOG(LS_INFO) << "RemoteBitrateEstimatorAbsSendTime: Instantiating."; |
97 network_thread_.DetachFromThread(); | |
98 } | 97 } |
99 | 98 |
100 void RemoteBitrateEstimatorAbsSendTime::ComputeClusters( | 99 void RemoteBitrateEstimatorAbsSendTime::ComputeClusters( |
101 std::list<Cluster>* clusters) const { | 100 std::list<Cluster>* clusters) const { |
102 Cluster current; | 101 Cluster current; |
103 int64_t prev_send_time = -1; | 102 int64_t prev_send_time = -1; |
104 int64_t prev_recv_time = -1; | 103 int64_t prev_recv_time = -1; |
105 for (std::list<Probe>::const_iterator it = probes_.begin(); | 104 for (std::list<Probe>::const_iterator it = probes_.begin(); |
106 it != probes_.end(); | 105 it != probes_.end(); |
107 ++it) { | 106 ++it) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 bool bitrate_above_estimate = | 203 bool bitrate_above_estimate = |
205 remote_rate_.ValidEstimate() && | 204 remote_rate_.ValidEstimate() && |
206 new_bitrate_bps > static_cast<int>(remote_rate_.LatestEstimate()); | 205 new_bitrate_bps > static_cast<int>(remote_rate_.LatestEstimate()); |
207 return initial_probe || bitrate_above_estimate; | 206 return initial_probe || bitrate_above_estimate; |
208 } | 207 } |
209 | 208 |
210 void RemoteBitrateEstimatorAbsSendTime::IncomingPacket( | 209 void RemoteBitrateEstimatorAbsSendTime::IncomingPacket( |
211 int64_t arrival_time_ms, | 210 int64_t arrival_time_ms, |
212 size_t payload_size, | 211 size_t payload_size, |
213 const RTPHeader& header) { | 212 const RTPHeader& header) { |
214 RTC_DCHECK(network_thread_.CalledOnValidThread()); | 213 RTC_DCHECK_RUNS_SERIALIZED(&network_race_); |
215 if (!header.extension.hasAbsoluteSendTime) { | 214 if (!header.extension.hasAbsoluteSendTime) { |
216 LOG(LS_WARNING) << "RemoteBitrateEstimatorAbsSendTimeImpl: Incoming packet " | 215 LOG(LS_WARNING) << "RemoteBitrateEstimatorAbsSendTimeImpl: Incoming packet " |
217 "is missing absolute send time extension!"; | 216 "is missing absolute send time extension!"; |
218 return; | 217 return; |
219 } | 218 } |
220 IncomingPacketInfo(arrival_time_ms, header.extension.absoluteSendTime, | 219 IncomingPacketInfo(arrival_time_ms, header.extension.absoluteSendTime, |
221 payload_size, header.ssrc); | 220 payload_size, header.ssrc); |
222 } | 221 } |
223 | 222 |
224 void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( | 223 void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo( |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 return true; | 401 return true; |
403 } | 402 } |
404 | 403 |
405 void RemoteBitrateEstimatorAbsSendTime::SetMinBitrate(int min_bitrate_bps) { | 404 void RemoteBitrateEstimatorAbsSendTime::SetMinBitrate(int min_bitrate_bps) { |
406 // Called from both the configuration thread and the network thread. Shouldn't | 405 // Called from both the configuration thread and the network thread. Shouldn't |
407 // be called from the network thread in the future. | 406 // be called from the network thread in the future. |
408 rtc::CritScope lock(&crit_); | 407 rtc::CritScope lock(&crit_); |
409 remote_rate_.SetMinBitrate(min_bitrate_bps); | 408 remote_rate_.SetMinBitrate(min_bitrate_bps); |
410 } | 409 } |
411 } // namespace webrtc | 410 } // namespace webrtc |
OLD | NEW |