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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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); |
80 channel_proxy_->SetRtcEventLog(event_log); | 81 channel_proxy_->SetRtcEventLog(event_log); |
81 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc); | 82 channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc); |
82 // TODO(solenberg): Config NACK history window (which is a packet count), | 83 // TODO(solenberg): Config NACK history window (which is a packet count), |
83 // using the actual packet size for the configured codec. | 84 // using the actual packet size for the configured codec. |
84 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, | 85 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, |
85 config_.rtp.nack.rtp_history_ms / 20); | 86 config_.rtp.nack.rtp_history_ms / 20); |
86 | 87 |
87 // TODO(ossu): This is where we'd like to set the decoder factory to | 88 // TODO(ossu): This is where we'd like to set the decoder factory to |
88 // use. However, since it needs to be included when constructing Channel, we | 89 // use. However, since it needs to be included when constructing Channel, we |
89 // cannot do that until we're able to move Channel ownership into the | 90 // cannot do that until we're able to move Channel ownership into the |
90 // Audio{Send,Receive}Streams. The best we can do is check that we're not | 91 // Audio{Send,Receive}Streams. The best we can do is check that we're not |
91 // trying to use two different factories using the different interfaces. | 92 // trying to use two different factories using the different interfaces. |
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 channel_proxy_->SetReceiveCodecs(config.decoder_map); | 98 channel_proxy_->SetReceiveCodecs(config.decoder_map); |
98 | 99 |
99 for (const auto& extension : config.rtp.extensions) { | |
100 if (extension.uri == RtpExtension::kAudioLevelUri) { | |
101 channel_proxy_->SetReceiveAudioLevelIndicationStatus(true, extension.id); | |
102 } else if (extension.uri == RtpExtension::kTransportSequenceNumberUri) { | |
103 channel_proxy_->EnableReceiveTransportSequenceNumber(extension.id); | |
104 } else { | |
105 RTC_NOTREACHED() << "Unsupported RTP extension."; | |
106 } | |
107 } | |
108 // Configure bandwidth estimation. | 100 // Configure bandwidth estimation. |
109 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); | 101 channel_proxy_->RegisterReceiverCongestionControlObjects(packet_router); |
110 } | 102 } |
111 | 103 |
112 AudioReceiveStream::~AudioReceiveStream() { | 104 AudioReceiveStream::~AudioReceiveStream() { |
113 RTC_DCHECK_RUN_ON(&worker_thread_checker_); | 105 RTC_DCHECK_RUN_ON(&worker_thread_checker_); |
114 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); | 106 LOG(LS_INFO) << "~AudioReceiveStream: " << config_.ToString(); |
115 if (playing_) { | 107 if (playing_) { |
116 Stop(); | 108 Stop(); |
117 } | 109 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 285 } |
294 | 286 |
295 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { | 287 bool AudioReceiveStream::DeliverRtcp(const uint8_t* packet, size_t length) { |
296 // TODO(solenberg): Tests call this function on a network thread, libjingle | 288 // TODO(solenberg): Tests call this function on a network thread, libjingle |
297 // calls on the worker thread. We should move towards always using a network | 289 // calls on the worker thread. We should move towards always using a network |
298 // thread. Then this check can be enabled. | 290 // thread. Then this check can be enabled. |
299 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 291 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
300 return channel_proxy_->ReceivedRTCPPacket(packet, length); | 292 return channel_proxy_->ReceivedRTCPPacket(packet, length); |
301 } | 293 } |
302 | 294 |
303 void AudioReceiveStream::OnRtpPacket(const RtpPacketReceived& packet) { | 295 bool AudioReceiveStream::OnRtpPacketReceive(RtpPacketReceived* packet) { |
304 // TODO(solenberg): Tests call this function on a network thread, libjingle | 296 // TODO(solenberg): Tests call this function on a network thread, libjingle |
305 // calls on the worker thread. We should move towards always using a network | 297 // calls on the worker thread. We should move towards always using a network |
306 // thread. Then this check can be enabled. | 298 // thread. Then this check can be enabled. |
307 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 299 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
308 channel_proxy_->OnRtpPacket(packet); | 300 packet->IdentifyExtensions(rtp_header_extensions_); |
301 channel_proxy_->OnRtpPacket(*packet); | |
nisse-webrtc
2017/04/19 08:35:43
This is where we need channel_proxy_ to implement
| |
302 return true; | |
309 } | 303 } |
310 | 304 |
311 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { | 305 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { |
312 RTC_DCHECK_RUN_ON(&worker_thread_checker_); | 306 RTC_DCHECK_RUN_ON(&worker_thread_checker_); |
313 return config_; | 307 return config_; |
314 } | 308 } |
315 | 309 |
316 VoiceEngine* AudioReceiveStream::voice_engine() const { | 310 VoiceEngine* AudioReceiveStream::voice_engine() const { |
317 auto* voice_engine = audio_state()->voice_engine(); | 311 auto* voice_engine = audio_state()->voice_engine(); |
318 RTC_DCHECK(voice_engine); | 312 RTC_DCHECK(voice_engine); |
319 return voice_engine; | 313 return voice_engine; |
320 } | 314 } |
321 | 315 |
322 internal::AudioState* AudioReceiveStream::audio_state() const { | 316 internal::AudioState* AudioReceiveStream::audio_state() const { |
323 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get()); | 317 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get()); |
324 RTC_DCHECK(audio_state); | 318 RTC_DCHECK(audio_state); |
325 return audio_state; | 319 return audio_state; |
326 } | 320 } |
327 | 321 |
328 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { | 322 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { |
329 ScopedVoEInterface<VoEBase> base(voice_engine()); | 323 ScopedVoEInterface<VoEBase> base(voice_engine()); |
330 if (playout) { | 324 if (playout) { |
331 return base->StartPlayout(config_.voe_channel_id); | 325 return base->StartPlayout(config_.voe_channel_id); |
332 } else { | 326 } else { |
333 return base->StopPlayout(config_.voe_channel_id); | 327 return base->StopPlayout(config_.voe_channel_id); |
334 } | 328 } |
335 } | 329 } |
336 } // namespace internal | 330 } // namespace internal |
337 } // namespace webrtc | 331 } // namespace webrtc |
OLD | NEW |