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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 namespace internal { | 68 namespace internal { |
69 AudioReceiveStream::AudioReceiveStream( | 69 AudioReceiveStream::AudioReceiveStream( |
70 PacketRouter* packet_router, | 70 PacketRouter* packet_router, |
71 RemoteBitrateEstimator* remote_bitrate_estimator, | 71 RemoteBitrateEstimator* remote_bitrate_estimator, |
72 const webrtc::AudioReceiveStream::Config& config, | 72 const webrtc::AudioReceiveStream::Config& config, |
73 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 73 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
74 webrtc::RtcEventLog* event_log) | 74 webrtc::RtcEventLog* event_log) |
75 : remote_bitrate_estimator_(remote_bitrate_estimator), | 75 : remote_bitrate_estimator_(remote_bitrate_estimator), |
76 config_(config), | 76 config_(config), |
77 audio_state_(audio_state), | 77 audio_state_(audio_state) { |
78 rtp_header_parser_(RtpHeaderParser::Create()) { | |
79 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); | 78 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); |
80 RTC_DCHECK_NE(config_.voe_channel_id, -1); | 79 RTC_DCHECK_NE(config_.voe_channel_id, -1); |
81 RTC_DCHECK(audio_state_.get()); | 80 RTC_DCHECK(audio_state_.get()); |
82 RTC_DCHECK(packet_router); | 81 RTC_DCHECK(packet_router); |
83 RTC_DCHECK(remote_bitrate_estimator); | 82 RTC_DCHECK(remote_bitrate_estimator); |
84 RTC_DCHECK(rtp_header_parser_); | |
85 | 83 |
86 module_process_thread_checker_.DetachFromThread(); | 84 module_process_thread_checker_.DetachFromThread(); |
87 | 85 |
88 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); | 86 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); |
89 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); | 87 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); |
90 channel_proxy_->SetRtcEventLog(event_log); | 88 channel_proxy_->SetRtcEventLog(event_log); |
91 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc); | 89 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc); |
92 // TODO(solenberg): Config NACK history window (which is a packet count), | 90 // TODO(solenberg): Config NACK history window (which is a packet count), |
93 // using the actual packet size for the configured codec. | 91 // using the actual packet size for the configured codec. |
94 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, | 92 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, |
(...skipping 10 matching lines...) Expand all Loading... |
105 | 103 |
106 channel_proxy_->RegisterExternalTransport(config.rtcp_send_transport); | 104 channel_proxy_->RegisterExternalTransport(config.rtcp_send_transport); |
107 | 105 |
108 for (const auto& kv : config.decoder_map) { | 106 for (const auto& kv : config.decoder_map) { |
109 channel_proxy_->SetRecPayloadType(kv.first, kv.second); | 107 channel_proxy_->SetRecPayloadType(kv.first, kv.second); |
110 } | 108 } |
111 | 109 |
112 for (const auto& extension : config.rtp.extensions) { | 110 for (const auto& extension : config.rtp.extensions) { |
113 if (extension.uri == RtpExtension::kAudioLevelUri) { | 111 if (extension.uri == RtpExtension::kAudioLevelUri) { |
114 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id); | 112 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id); |
115 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( | |
116 kRtpExtensionAudioLevel, extension.id); | |
117 RTC_DCHECK(registered); | |
118 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { | 113 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { |
119 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id); | 114 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id); |
120 bool registered = rtp_header_parser_->RegisterRtpHeaderExtension( | |
121 kRtpExtensionTransportSequenceNumber, extension.id); | |
122 RTC_DCHECK(registered); | |
123 } else { | 115 } else { |
124 RTC_NOTREACHED() << "Unsupported RTP extension."; | 116 RTC_NOTREACHED() << "Unsupported RTP extension."; |
125 } | 117 } |
126 } | 118 } |
127 // Configure bandwidth estimation. | 119 // Configure bandwidth estimation. |
128 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); | 120 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); |
129 } | 121 } |
130 | 122 |
131 AudioReceiveStream::~AudioReceiveStream() { | 123 AudioReceiveStream::~AudioReceiveStream() { |
132 RTC_DCHECK_RUN_ON(&worker_thread_checker_); | 124 RTC_DCHECK_RUN_ON(&worker_thread_checker_); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 return channel_proxy_->ReceivedRTCPPacket(packet, length); | 310 return channel_proxy_->ReceivedRTCPPacket(packet, length); |
319 } | 311 } |
320 | 312 |
321 bool AudioReceiveStream::DeliverRtp(const uint8_t* packet, | 313 bool AudioReceiveStream::DeliverRtp(const uint8_t* packet, |
322 size_t length, | 314 size_t length, |
323 const PacketTime& packet_time) { | 315 const PacketTime& packet_time) { |
324 // TODO(solenberg): Tests call this function on a network thread, libjingle | 316 // 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 | 317 // calls on the worker thread. We should move towards always using a network |
326 // thread. Then this check can be enabled. | 318 // thread. Then this check can be enabled. |
327 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 319 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
328 RTPHeader header; | |
329 if (!rtp_header_parser_->Parse(packet, length, &header)) { | |
330 return false; | |
331 } | |
332 | |
333 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); | 320 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); |
334 } | 321 } |
335 | 322 |
336 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { | 323 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { |
337 RTC_DCHECK_RUN_ON(&worker_thread_checker_); | 324 RTC_DCHECK_RUN_ON(&worker_thread_checker_); |
338 return config_; | 325 return config_; |
339 } | 326 } |
340 | 327 |
341 VoiceEngine* AudioReceiveStream::voice_engine() const { | 328 VoiceEngine* AudioReceiveStream::voice_engine() const { |
342 auto* voice_engine = audio_state()->voice_engine(); | 329 auto* voice_engine = audio_state()->voice_engine(); |
(...skipping 10 matching lines...) Expand all Loading... |
353 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { | 340 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { |
354 ScopedVoEInterface<VoEBase> base(voice_engine()); | 341 ScopedVoEInterface<VoEBase> base(voice_engine()); |
355 if (playout) { | 342 if (playout) { |
356 return base->StartPlayout(config_.voe_channel_id); | 343 return base->StartPlayout(config_.voe_channel_id); |
357 } else { | 344 } else { |
358 return base->StopPlayout(config_.voe_channel_id); | 345 return base->StopPlayout(config_.voe_channel_id); |
359 } | 346 } |
360 } | 347 } |
361 } // namespace internal | 348 } // namespace internal |
362 } // namespace webrtc | 349 } // namespace webrtc |
OLD | NEW |