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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 const PacketTime& packet_time) { | 323 const PacketTime& packet_time) { |
324 // TODO(solenberg): Tests call this function on a network thread, libjingle | 324 // TODO(solenberg): Tests call this function on a network thread, libjingle |
325 // calls on the worker thread. We should move towards always using a network | 325 // calls on the worker thread. We should move towards always using a network |
326 // thread. Then this check can be enabled. | 326 // thread. Then this check can be enabled. |
327 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 327 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
328 RTPHeader header; | 328 RTPHeader header; |
329 if (!rtp_header_parser_->Parse(packet, length, &header)) { | 329 if (!rtp_header_parser_->Parse(packet, length, &header)) { |
330 return false; | 330 return false; |
331 } | 331 } |
332 | 332 |
| 333 // Only forward if the parsed header has one of the headers necessary for |
| 334 // bandwidth estimation. RTP timestamps has different rates for audio and |
| 335 // video and shouldn't be mixed. |
| 336 if (config_.rtp.transport_cc && |
| 337 header.extension.hasTransportSequenceNumber) { |
| 338 int64_t arrival_time_ms = rtc::TimeMillis(); |
| 339 if (packet_time.timestamp >= 0) |
| 340 arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
| 341 size_t payload_size = length - header.headerLength; |
| 342 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, |
| 343 header); |
| 344 } |
| 345 |
333 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); | 346 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); |
334 } | 347 } |
335 | 348 |
336 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { | 349 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { |
337 RTC_DCHECK_RUN_ON(&worker_thread_checker_); | 350 RTC_DCHECK_RUN_ON(&worker_thread_checker_); |
338 return config_; | 351 return config_; |
339 } | 352 } |
340 | 353 |
341 VoiceEngine* AudioReceiveStream::voice_engine() const { | 354 VoiceEngine* AudioReceiveStream::voice_engine() const { |
342 auto* voice_engine = audio_state()->voice_engine(); | 355 auto* voice_engine = audio_state()->voice_engine(); |
(...skipping 10 matching lines...) Expand all Loading... |
353 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { | 366 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { |
354 ScopedVoEInterface<VoEBase> base(voice_engine()); | 367 ScopedVoEInterface<VoEBase> base(voice_engine()); |
355 if (playout) { | 368 if (playout) { |
356 return base->StartPlayout(config_.voe_channel_id); | 369 return base->StartPlayout(config_.voe_channel_id); |
357 } else { | 370 } else { |
358 return base->StopPlayout(config_.voe_channel_id); | 371 return base->StopPlayout(config_.voe_channel_id); |
359 } | 372 } |
360 } | 373 } |
361 } // namespace internal | 374 } // namespace internal |
362 } // namespace webrtc | 375 } // namespace webrtc |
OLD | NEW |