Chromium Code Reviews| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 return ss.str(); | 63 return ss.str(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 namespace internal { | 66 namespace internal { |
| 67 AudioReceiveStream::AudioReceiveStream( | 67 AudioReceiveStream::AudioReceiveStream( |
| 68 PacketRouter* packet_router, | 68 PacketRouter* packet_router, |
| 69 RemoteBitrateEstimator* remote_bitrate_estimator, | 69 RemoteBitrateEstimator* remote_bitrate_estimator, |
| 70 const webrtc::AudioReceiveStream::Config& config, | 70 const webrtc::AudioReceiveStream::Config& config, |
| 71 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 71 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
| 72 webrtc::RtcEventLog* event_log) | 72 webrtc::RtcEventLog* event_log) |
| 73 : remote_bitrate_estimator_(remote_bitrate_estimator), | 73 : remote_bitrate_estimator_(remote_bitrate_estimator), |
|
brandtr
2017/01/30 12:03:53
Can |remote_bitrate_estimator_| be completely remo
nisse-webrtc
2017/01/30 14:56:57
I plan that for the next cl. There's a call to Rem
| |
| 74 config_(config), | 74 config_(config), |
| 75 audio_state_(audio_state), | 75 audio_state_(audio_state), |
| 76 rtp_header_parser_(RtpHeaderParser::Create()) { | 76 rtp_header_parser_(RtpHeaderParser::Create()) { |
| 77 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); | 77 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); |
| 78 RTC_DCHECK_NE(config_.voe_channel_id, -1); | 78 RTC_DCHECK_NE(config_.voe_channel_id, -1); |
| 79 RTC_DCHECK(audio_state_.get()); | 79 RTC_DCHECK(audio_state_.get()); |
| 80 RTC_DCHECK(packet_router); | 80 RTC_DCHECK(packet_router); |
| 81 RTC_DCHECK(remote_bitrate_estimator); | 81 RTC_DCHECK(remote_bitrate_estimator); |
| 82 RTC_DCHECK(rtp_header_parser_); | 82 RTC_DCHECK(rtp_header_parser_); |
| 83 | 83 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 const PacketTime& packet_time) { | 263 const PacketTime& packet_time) { |
| 264 // TODO(solenberg): Tests call this function on a network thread, libjingle | 264 // TODO(solenberg): Tests call this function on a network thread, libjingle |
| 265 // calls on the worker thread. We should move towards always using a network | 265 // calls on the worker thread. We should move towards always using a network |
| 266 // thread. Then this check can be enabled. | 266 // thread. Then this check can be enabled. |
| 267 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 267 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
| 268 RTPHeader header; | 268 RTPHeader header; |
| 269 if (!rtp_header_parser_->Parse(packet, length, &header)) { | 269 if (!rtp_header_parser_->Parse(packet, length, &header)) { |
| 270 return false; | 270 return false; |
| 271 } | 271 } |
| 272 | 272 |
| 273 // Only forward if the parsed header has one of the headers necessary for | |
| 274 // bandwidth estimation. RTP timestamps has different rates for audio and | |
| 275 // video and shouldn't be mixed. | |
| 276 if (config_.rtp.transport_cc && | |
| 277 header.extension.hasTransportSequenceNumber) { | |
| 278 int64_t arrival_time_ms = rtc::TimeMillis(); | |
| 279 if (packet_time.timestamp >= 0) | |
| 280 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | |
| 281 size_t payload_size = length - header.headerLength; | |
| 282 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, | |
| 283 header); | |
| 284 } | |
| 285 | |
| 286 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); | 273 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); |
| 287 } | 274 } |
| 288 | 275 |
| 289 AudioMixer::Source::AudioFrameInfo AudioReceiveStream::GetAudioFrameWithInfo( | 276 AudioMixer::Source::AudioFrameInfo AudioReceiveStream::GetAudioFrameWithInfo( |
| 290 int sample_rate_hz, | 277 int sample_rate_hz, |
| 291 AudioFrame* audio_frame) { | 278 AudioFrame* audio_frame) { |
| 292 return channel_proxy_->GetAudioFrameWithInfo(sample_rate_hz, audio_frame); | 279 return channel_proxy_->GetAudioFrameWithInfo(sample_rate_hz, audio_frame); |
| 293 } | 280 } |
| 294 | 281 |
| 295 int AudioReceiveStream::PreferredSampleRate() const { | 282 int AudioReceiveStream::PreferredSampleRate() const { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 316 ScopedVoEInterface<VoEBase> base(voice_engine()); | 303 ScopedVoEInterface<VoEBase> base(voice_engine()); |
| 317 if (playout) { | 304 if (playout) { |
| 318 return base->StartPlayout(config_.voe_channel_id); | 305 return base->StartPlayout(config_.voe_channel_id); |
| 319 } else { | 306 } else { |
| 320 return base->StopPlayout(config_.voe_channel_id); | 307 return base->StopPlayout(config_.voe_channel_id); |
| 321 } | 308 } |
| 322 } | 309 } |
| 323 | 310 |
| 324 } // namespace internal | 311 } // namespace internal |
| 325 } // namespace webrtc | 312 } // namespace webrtc |
| OLD | NEW |