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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 AudioSendStream::~AudioSendStream() { | 94 AudioSendStream::~AudioSendStream() { |
95 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 95 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
96 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); | 96 LOG(LS_INFO) << "~AudioSendStream: " << config_.ToString(); |
97 channel_proxy_->DeRegisterExternalTransport(); | 97 channel_proxy_->DeRegisterExternalTransport(); |
98 channel_proxy_->ResetCongestionControlObjects(); | 98 channel_proxy_->ResetCongestionControlObjects(); |
99 channel_proxy_->SetRtcEventLog(nullptr); | 99 channel_proxy_->SetRtcEventLog(nullptr); |
100 } | 100 } |
101 | 101 |
102 void AudioSendStream::Start() { | 102 void AudioSendStream::Start() { |
103 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 103 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
104 if (config_.min_bitrate_kbps != -1 && config_.max_bitrate_kbps != -1) { | 104 if (config_.min_bitrate_bps != -1 && config_.max_bitrate_bps != -1) { |
105 RTC_DCHECK_GE(config_.max_bitrate_kbps, config_.min_bitrate_kbps); | 105 RTC_DCHECK_GE(config_.max_bitrate_bps, config_.min_bitrate_bps); |
106 rtc::Event thread_sync_event(false /* manual_reset */, false); | 106 rtc::Event thread_sync_event(false /* manual_reset */, false); |
107 worker_queue_->PostTask([this, &thread_sync_event] { | 107 worker_queue_->PostTask([this, &thread_sync_event] { |
108 bitrate_allocator_->AddObserver(this, config_.min_bitrate_kbps * 1000, | 108 bitrate_allocator_->AddObserver(this, config_.min_bitrate_bps, |
109 config_.max_bitrate_kbps * 1000, 0, true); | 109 config_.max_bitrate_bps, 0, true); |
110 thread_sync_event.Set(); | 110 thread_sync_event.Set(); |
111 }); | 111 }); |
112 thread_sync_event.Wait(rtc::Event::kForever); | 112 thread_sync_event.Wait(rtc::Event::kForever); |
113 } | 113 } |
114 | 114 |
115 ScopedVoEInterface<VoEBase> base(voice_engine()); | 115 ScopedVoEInterface<VoEBase> base(voice_engine()); |
116 int error = base->StartSend(config_.voe_channel_id); | 116 int error = base->StartSend(config_.voe_channel_id); |
117 if (error != 0) { | 117 if (error != 0) { |
118 LOG(LS_ERROR) << "AudioSendStream::Start failed with error: " << error; | 118 LOG(LS_ERROR) << "AudioSendStream::Start failed with error: " << error; |
119 } | 119 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // calls on the worker thread. We should move towards always using a network | 242 // calls on the worker thread. We should move towards always using a network |
243 // thread. Then this check can be enabled. | 243 // thread. Then this check can be enabled. |
244 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); | 244 // RTC_DCHECK(!thread_checker_.CalledOnValidThread()); |
245 return channel_proxy_->ReceivedRTCPPacket(packet, length); | 245 return channel_proxy_->ReceivedRTCPPacket(packet, length); |
246 } | 246 } |
247 | 247 |
248 uint32_t AudioSendStream::OnBitrateUpdated(uint32_t bitrate_bps, | 248 uint32_t AudioSendStream::OnBitrateUpdated(uint32_t bitrate_bps, |
249 uint8_t fraction_loss, | 249 uint8_t fraction_loss, |
250 int64_t rtt) { | 250 int64_t rtt) { |
251 RTC_DCHECK_GE(bitrate_bps, | 251 RTC_DCHECK_GE(bitrate_bps, |
252 static_cast<uint32_t>(config_.min_bitrate_kbps * 1000)); | 252 static_cast<uint32_t>(config_.min_bitrate_bps)); |
253 // The bitrate allocator might allocate an higher than max configured bitrate | 253 // The bitrate allocator might allocate an higher than max configured bitrate |
254 // if there is room, to allow for, as example, extra FEC. Ignore that for now. | 254 // if there is room, to allow for, as example, extra FEC. Ignore that for now. |
255 const uint32_t max_bitrate_bps = config_.max_bitrate_kbps * 1000; | 255 const uint32_t max_bitrate_bps = config_.max_bitrate_bps; |
256 if (bitrate_bps > max_bitrate_bps) | 256 if (bitrate_bps > max_bitrate_bps) |
257 bitrate_bps = max_bitrate_bps; | 257 bitrate_bps = max_bitrate_bps; |
258 | 258 |
259 channel_proxy_->SetBitrate(bitrate_bps); | 259 channel_proxy_->SetBitrate(bitrate_bps); |
260 | 260 |
261 // The amount of audio protection is not exposed by the encoder, hence | 261 // The amount of audio protection is not exposed by the encoder, hence |
262 // always returning 0. | 262 // always returning 0. |
263 return 0; | 263 return 0; |
264 } | 264 } |
265 | 265 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError(); | 386 LOG(LS_WARNING) << "SetVADStatus() failed: " << base->LastError(); |
387 return false; | 387 return false; |
388 } | 388 } |
389 } | 389 } |
390 } | 390 } |
391 return true; | 391 return true; |
392 } | 392 } |
393 | 393 |
394 } // namespace internal | 394 } // namespace internal |
395 } // namespace webrtc | 395 } // namespace webrtc |
OLD | NEW |