Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: webrtc/audio/audio_receive_stream.cc

Issue 2709723003: Initial implementation of RtpTransportControllerReceive and related interfaces.
Patch Set: Adapt Call to use the new RtpTransportReceive class. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return ss.str(); 60 return ss.str();
61 } 61 }
62 62
63 namespace internal { 63 namespace internal {
64 AudioReceiveStream::AudioReceiveStream( 64 AudioReceiveStream::AudioReceiveStream(
65 PacketRouter* packet_router, 65 PacketRouter* packet_router,
66 const webrtc::AudioReceiveStream::Config& config, 66 const webrtc::AudioReceiveStream::Config& config,
67 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, 67 const rtc::scoped_refptr<webrtc::AudioState>& audio_state,
68 webrtc::RtcEventLog* event_log) 68 webrtc::RtcEventLog* event_log)
69 : config_(config), 69 : config_(config),
70 rtp_header_extensions_(config.rtp.extensions),
70 audio_state_(audio_state) { 71 audio_state_(audio_state) {
71 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString(); 72 LOG(LS_INFO) << "AudioReceiveStream: " << config_.ToString();
72 RTC_DCHECK_NE(config_.voe_channel_id, -1); 73 RTC_DCHECK_NE(config_.voe_channel_id, -1);
73 RTC_DCHECK(audio_state_.get()); 74 RTC_DCHECK(audio_state_.get());
74 RTC_DCHECK(packet_router); 75 RTC_DCHECK(packet_router);
75 76
76 module_process_thread_checker_.DetachFromThread(); 77 module_process_thread_checker_.DetachFromThread();
77 78
78 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); 79 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
79 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); 80 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
(...skipping 12 matching lines...) Expand all
92 RTC_CHECK(config.decoder_factory); 93 RTC_CHECK(config.decoder_factory);
93 RTC_CHECK_EQ(config.decoder_factory, 94 RTC_CHECK_EQ(config.decoder_factory,
94 channel_proxy_->GetAudioDecoderFactory()); 95 channel_proxy_->GetAudioDecoderFactory());
95 96
96 channel_proxy_->RegisterExternalTransport(config.rtcp_send_transport); 97 channel_proxy_->RegisterExternalTransport(config.rtcp_send_transport);
97 98
98 for (const auto& kv : config.decoder_map) { 99 for (const auto& kv : config.decoder_map) {
99 channel_proxy_->SetRecPayloadType(kv.first, kv.second); 100 channel_proxy_->SetRecPayloadType(kv.first, kv.second);
100 } 101 }
101 102
102 for (const auto& extension : config.rtp.extensions) {
103 if (extension.uri == RtpExtension::kAudioLevelUri) {
104 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id);
105 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) {
106 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id);
107 } else {
108 RTC_NOTREACHED() << "Unsupported RTP extension.";
109 }
110 }
111 // Configure bandwidth estimation. 103 // Configure bandwidth estimation.
112 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); 104 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router);
113 } 105 }
114 106
115 AudioReceiveStream::~AudioReceiveStream() { 107 AudioReceiveStream::~AudioReceiveStream() {
116 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 108 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
117 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); 109 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString();
118 if (playing_) { 110 if (playing_) {
119 Stop(); 111 Stop();
120 } 112 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 288 }
297 289
298 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { 290 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) {
299 // TODO(solenberg): Tests call this function on a network thread, libjingle 291 // TODO(solenberg): Tests call this function on a network thread, libjingle
300 // calls on the worker thread. We should move towards always using a network 292 // calls on the worker thread. We should move towards always using a network
301 // thread. Then this check can be enabled. 293 // thread. Then this check can be enabled.
302 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); 294 // RTC_DCHECK(!thread_checker_.CalledOnValidThread());
303 return channel_proxy_->ReceivedRTCPPacket(packet, length); 295 return channel_proxy_->ReceivedRTCPPacket(packet, length);
304 } 296 }
305 297
306 void AudioReceiveStream::OnRtpPacket(const RtpPacketReceived& packet) { 298 bool AudioReceiveStream::OnRtpPacketReceive(RtpPacketReceived* packet) {
307 // TODO(solenberg): Tests call this function on a network thread, libjingle 299 // TODO(solenberg): Tests call this function on a network thread, libjingle
308 // calls on the worker thread. We should move towards always using a network 300 // calls on the worker thread. We should move towards always using a network
309 // thread. Then this check can be enabled. 301 // thread. Then this check can be enabled.
310 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); 302 // RTC_DCHECK(!thread_checker_.CalledOnValidThread());
311 channel_proxy_->OnRtpPacket(packet); 303 packet->IdentifyExtensions(rtp_header_extensions_);
304 channel_proxy_->OnRtpPacket(*packet);
305 return true;
312 } 306 }
313 307
314 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { 308 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const {
315 RTC_DCHECK_RUN_ON(&worker_thread_checker_); 309 RTC_DCHECK_RUN_ON(&worker_thread_checker_);
316 return config_; 310 return config_;
317 } 311 }
318 312
319 VoiceEngine* AudioReceiveStream::voice_engine() const { 313 VoiceEngine* AudioReceiveStream::voice_engine() const {
320 auto* voice_engine = audio_state()->voice_engine(); 314 auto* voice_engine = audio_state()->voice_engine();
321 RTC_DCHECK(voice_engine); 315 RTC_DCHECK(voice_engine);
322 return voice_engine; 316 return voice_engine;
323 } 317 }
324 318
325 internal::AudioState* AudioReceiveStream::audio_state() const { 319 internal::AudioState* AudioReceiveStream::audio_state() const {
326 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get()); 320 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get());
327 RTC_DCHECK(audio_state); 321 RTC_DCHECK(audio_state);
328 return audio_state; 322 return audio_state;
329 } 323 }
330 324
331 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { 325 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) {
332 ScopedVoEInterface<VoEBase> base(voice_engine()); 326 ScopedVoEInterface<VoEBase> base(voice_engine());
333 if (playout) { 327 if (playout) {
334 return base->StartPlayout(config_.voe_channel_id); 328 return base->StartPlayout(config_.voe_channel_id);
335 } else { 329 } else {
336 return base->StopPlayout(config_.voe_channel_id); 330 return base->StopPlayout(config_.voe_channel_id);
337 } 331 }
338 } 332 }
339 } // namespace internal 333 } // namespace internal
340 } // namespace webrtc 334 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698