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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 void AudioReceiveStream::SetSink(std::unique_ptr<AudioSinkInterface> sink) { | 218 void AudioReceiveStream::SetSink(std::unique_ptr<AudioSinkInterface> sink) { |
219 RTC_DCHECK_RUN_ON(&thread_checker_); | 219 RTC_DCHECK_RUN_ON(&thread_checker_); |
220 channel_proxy_->SetSink(std::move(sink)); | 220 channel_proxy_->SetSink(std::move(sink)); |
221 } | 221 } |
222 | 222 |
223 void AudioReceiveStream::SetGain(float gain) { | 223 void AudioReceiveStream::SetGain(float gain) { |
224 RTC_DCHECK_RUN_ON(&thread_checker_); | 224 RTC_DCHECK_RUN_ON(&thread_checker_); |
225 channel_proxy_->SetChannelOutputVolumeScaling(gain); | 225 channel_proxy_->SetChannelOutputVolumeScaling(gain); |
226 } | 226 } |
227 | 227 |
228 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { | 228 AudioMixer::Source::AudioFrameInfo AudioReceiveStream::GetAudioFrameWithInfo( |
| 229 int sample_rate_hz, |
| 230 AudioFrame* audio_frame) { |
| 231 return channel_proxy_->GetAudioFrameWithInfo(sample_rate_hz, audio_frame); |
| 232 } |
| 233 |
| 234 int AudioReceiveStream::Ssrc() const { |
| 235 return config_.rtp.remote_ssrc; |
| 236 } |
| 237 |
| 238 int AudioReceiveStream::PreferredSampleRate() const { |
| 239 return channel_proxy_->NeededFrequency(); |
| 240 } |
| 241 |
| 242 void AudioReceiveStream::GetRtpRtcp(RtpRtcp** rtp_rtcp, |
| 243 RtpReceiver** rtp_receiver) const { |
229 RTC_DCHECK_RUN_ON(&thread_checker_); | 244 RTC_DCHECK_RUN_ON(&thread_checker_); |
230 return config_; | 245 channel_proxy_->GetRtpRtcp(rtp_rtcp, rtp_receiver); |
| 246 } |
| 247 |
| 248 void AudioReceiveStream::GetDelayEstimate(int* jitter_buffer_delay_ms, |
| 249 int* playout_buffer_delay_ms) const { |
| 250 // Called on Call's module_process_thread_. |
| 251 channel_proxy_->GetDelayEstimate(jitter_buffer_delay_ms, |
| 252 playout_buffer_delay_ms); |
| 253 } |
| 254 |
| 255 uint32_t AudioReceiveStream::GetPlayoutTimestamp() const { |
| 256 // Called on video capture thread. |
| 257 return channel_proxy_->GetPlayoutTimestamp(); |
| 258 } |
| 259 |
| 260 void AudioReceiveStream::SetMinimumPlayoutDelay(int delay_ms) { |
| 261 // Called on Call's module_process_thread_. |
| 262 return channel_proxy_->SetMinimumPlayoutDelay(delay_ms); |
| 263 } |
| 264 |
| 265 int AudioReceiveStream::id() const { |
| 266 RTC_DCHECK_RUN_ON(&thread_checker_); |
| 267 return config_.rtp.remote_ssrc; |
231 } | 268 } |
232 | 269 |
233 void AudioReceiveStream::AssociateSendStream(AudioSendStream* send_stream) { | 270 void AudioReceiveStream::AssociateSendStream(AudioSendStream* send_stream) { |
234 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 271 RTC_DCHECK_RUN_ON(&thread_checker_); |
235 if (send_stream) { | 272 if (send_stream) { |
236 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); | 273 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); |
237 std::unique_ptr<voe::ChannelProxy> send_channel_proxy = | 274 std::unique_ptr<voe::ChannelProxy> send_channel_proxy = |
238 voe_impl->GetChannelProxy(send_stream->config().voe_channel_id); | 275 voe_impl->GetChannelProxy(send_stream->config().voe_channel_id); |
239 channel_proxy_->AssociateSendChannel(*send_channel_proxy.get()); | 276 channel_proxy_->AssociateSendChannel(*send_channel_proxy.get()); |
240 } else { | 277 } else { |
241 channel_proxy_->DisassociateSendChannel(); | 278 channel_proxy_->DisassociateSendChannel(); |
242 } | 279 } |
243 } | 280 } |
244 | 281 |
(...skipping 30 matching lines...) Expand all Loading... |
275 if (packet_time.timestamp >= 0) | 312 if (packet_time.timestamp >= 0) |
276 arrival_time_ms = (packet_time.timestamp + 500) / 1000; | 313 arrival_time_ms = (packet_time.timestamp + 500) / 1000; |
277 size_t payload_size = length - header.headerLength; | 314 size_t payload_size = length - header.headerLength; |
278 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, | 315 remote_bitrate_estimator_->IncomingPacket(arrival_time_ms, payload_size, |
279 header); | 316 header); |
280 } | 317 } |
281 | 318 |
282 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); | 319 return channel_proxy_->ReceivedRTPPacket(packet, length, packet_time); |
283 } | 320 } |
284 | 321 |
285 AudioMixer::Source::AudioFrameInfo AudioReceiveStream::GetAudioFrameWithInfo( | 322 const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const { |
286 int sample_rate_hz, | 323 RTC_DCHECK_RUN_ON(&thread_checker_); |
287 AudioFrame* audio_frame) { | 324 return config_; |
288 return channel_proxy_->GetAudioFrameWithInfo(sample_rate_hz, audio_frame); | |
289 } | 325 } |
290 | 326 |
291 int AudioReceiveStream::PreferredSampleRate() const { | 327 VoiceEngine* AudioReceiveStream::voice_engine() const { |
292 return channel_proxy_->NeededFrequency(); | 328 auto* voice_engine = audio_state()->voice_engine(); |
293 } | 329 RTC_DCHECK(voice_engine); |
294 | 330 return voice_engine; |
295 int AudioReceiveStream::Ssrc() const { | |
296 return config_.rtp.remote_ssrc; | |
297 } | 331 } |
298 | 332 |
299 internal::AudioState* AudioReceiveStream::audio_state() const { | 333 internal::AudioState* AudioReceiveStream::audio_state() const { |
300 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get()); | 334 auto* audio_state = static_cast<internal::AudioState*>(audio_state_.get()); |
301 RTC_DCHECK(audio_state); | 335 RTC_DCHECK(audio_state); |
302 return audio_state; | 336 return audio_state; |
303 } | 337 } |
304 | 338 |
305 VoiceEngine* AudioReceiveStream::voice_engine() const { | |
306 auto* voice_engine = audio_state()->voice_engine(); | |
307 RTC_DCHECK(voice_engine); | |
308 return voice_engine; | |
309 } | |
310 | |
311 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { | 339 int AudioReceiveStream::SetVoiceEnginePlayout(bool playout) { |
312 ScopedVoEInterface<VoEBase> base(voice_engine()); | 340 ScopedVoEInterface<VoEBase> base(voice_engine()); |
313 if (playout) { | 341 if (playout) { |
314 return base->StartPlayout(config_.voe_channel_id); | 342 return base->StartPlayout(config_.voe_channel_id); |
315 } else { | 343 } else { |
316 return base->StopPlayout(config_.voe_channel_id); | 344 return base->StopPlayout(config_.voe_channel_id); |
317 } | 345 } |
318 } | 346 } |
319 | |
320 } // namespace internal | 347 } // namespace internal |
321 } // namespace webrtc | 348 } // namespace webrtc |
OLD | NEW |