| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 ss << '}'; | 56 ss << '}'; |
| 57 return ss.str(); | 57 return ss.str(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace internal { | 60 namespace internal { |
| 61 AudioSendStream::AudioSendStream( | 61 AudioSendStream::AudioSendStream( |
| 62 const webrtc::AudioSendStream::Config& config, | 62 const webrtc::AudioSendStream::Config& config, |
| 63 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, | 63 const rtc::scoped_refptr<webrtc::AudioState>& audio_state, |
| 64 rtc::TaskQueue* worker_queue, | 64 rtc::TaskQueue* worker_queue, |
| 65 CongestionController* congestion_controller, | 65 CongestionController* congestion_controller, |
| 66 BitrateAllocator* bitrate_allocator) | 66 BitrateAllocator* bitrate_allocator, |
| 67 RtcEventLog* event_log) |
| 67 : worker_queue_(worker_queue), | 68 : worker_queue_(worker_queue), |
| 68 config_(config), | 69 config_(config), |
| 69 audio_state_(audio_state), | 70 audio_state_(audio_state), |
| 70 bitrate_allocator_(bitrate_allocator) { | 71 bitrate_allocator_(bitrate_allocator) { |
| 71 LOG(LS_INFO) << "AudioSendStream: " << config_.ToString(); | 72 LOG(LS_INFO) << "AudioSendStream: " << 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(congestion_controller); | 75 RTC_DCHECK(congestion_controller); |
| 75 | 76 |
| 76 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); | 77 VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine()); |
| 77 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); | 78 channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id); |
| 79 channel_proxy_->SetRtcEventLog(event_log); |
| 78 channel_proxy_->RegisterSenderCongestionControlObjects( | 80 channel_proxy_->RegisterSenderCongestionControlObjects( |
| 79 congestion_controller->pacer(), | 81 congestion_controller->pacer(), |
| 80 congestion_controller->GetTransportFeedbackObserver(), | 82 congestion_controller->GetTransportFeedbackObserver(), |
| 81 congestion_controller->packet_router()); | 83 congestion_controller->packet_router()); |
| 82 channel_proxy_->SetRTCPStatus(true); | 84 channel_proxy_->SetRTCPStatus(true); |
| 83 channel_proxy_->SetLocalSSRC(config.rtp.ssrc); | 85 channel_proxy_->SetLocalSSRC(config.rtp.ssrc); |
| 84 channel_proxy_->SetRTCP_CNAME(config.rtp.c_name); | 86 channel_proxy_->SetRTCP_CNAME(config.rtp.c_name); |
| 85 // TODO(solenberg): Config NACK history window (which is a packet count), | 87 // TODO(solenberg): Config NACK history window (which is a packet count), |
| 86 // using the actual packet size for the configured codec. | 88 // using the actual packet size for the configured codec. |
| 87 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, | 89 channel_proxy_->SetNACKStatus(config_.rtp.nack.rtp_history_ms != 0, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 100 RTC_NOTREACHED() << "Registering unsupported RTP extension."; | 102 RTC_NOTREACHED() << "Registering unsupported RTP extension."; |
| 101 } | 103 } |
| 102 } | 104 } |
| 103 } | 105 } |
| 104 | 106 |
| 105 AudioSendStream::~AudioSendStream() { | 107 AudioSendStream::~AudioSendStream() { |
| 106 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 108 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 107 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); | 109 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); |
| 108 channel_proxy_->DeRegisterExternalTransport(); | 110 channel_proxy_->DeRegisterExternalTransport(); |
| 109 channel_proxy_->ResetCongestionControlObjects(); | 111 channel_proxy_->ResetCongestionControlObjects(); |
| 112 channel_proxy_->SetRtcEventLog(nullptr); |
| 110 } | 113 } |
| 111 | 114 |
| 112 void AudioSendStream::Start() { | 115 void AudioSendStream::Start() { |
| 113 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 116 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 114 if (config_.min_bitrate_kbps != -1 && config_.max_bitrate_kbps != -1) { | 117 if (config_.min_bitrate_kbps != -1 && config_.max_bitrate_kbps != -1) { |
| 115 RTC_DCHECK_GE(config_.max_bitrate_kbps, config_.min_bitrate_kbps); | 118 RTC_DCHECK_GE(config_.max_bitrate_kbps, config_.min_bitrate_kbps); |
| 116 rtc::Event thread_sync_event(false /* manual_reset */, false); | 119 rtc::Event thread_sync_event(false /* manual_reset */, false); |
| 117 worker_queue_->PostTask([this, &thread_sync_event] { | 120 worker_queue_->PostTask([this, &thread_sync_event] { |
| 118 bitrate_allocator_->AddObserver(this, config_.min_bitrate_kbps * 1000, | 121 bitrate_allocator_->AddObserver(this, config_.min_bitrate_kbps * 1000, |
| 119 config_.max_bitrate_kbps * 1000, 0, true); | 122 config_.max_bitrate_kbps * 1000, 0, true); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 280 |
| 278 VoiceEngine* AudioSendStream::voice_engine() const { | 281 VoiceEngine* AudioSendStream::voice_engine() const { |
| 279 internal::AudioState* audio_state = | 282 internal::AudioState* audio_state = |
| 280 static_cast<internal::AudioState*>(audio_state_.get()); | 283 static_cast<internal::AudioState*>(audio_state_.get()); |
| 281 VoiceEngine* voice_engine = audio_state->voice_engine(); | 284 VoiceEngine* voice_engine = audio_state->voice_engine(); |
| 282 RTC_DCHECK(voice_engine); | 285 RTC_DCHECK(voice_engine); |
| 283 return voice_engine; | 286 return voice_engine; |
| 284 } | 287 } |
| 285 } // namespace internal | 288 } // namespace internal |
| 286 } // namespace webrtc | 289 } // namespace webrtc |
| OLD | NEW |