| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 int channel() const { | 1334 int channel() const { |
| 1335 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1335 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1336 return config_.voe_channel_id; | 1336 return config_.voe_channel_id; |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 void SetRawAudioSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) { | 1339 void SetRawAudioSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
| 1340 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1340 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1341 stream_->SetSink(std::move(sink)); | 1341 stream_->SetSink(std::move(sink)); |
| 1342 } | 1342 } |
| 1343 | 1343 |
| 1344 void SetOutputVolume(double volume) { |
| 1345 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1346 stream_->SetGain(volume); |
| 1347 } |
| 1348 |
| 1344 private: | 1349 private: |
| 1345 void RecreateAudioReceiveStream( | 1350 void RecreateAudioReceiveStream( |
| 1346 uint32_t local_ssrc, | 1351 uint32_t local_ssrc, |
| 1347 bool use_transport_cc, | 1352 bool use_transport_cc, |
| 1348 bool use_nack, | 1353 bool use_nack, |
| 1349 const std::vector<webrtc::RtpExtension>& extensions) { | 1354 const std::vector<webrtc::RtpExtension>& extensions) { |
| 1350 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1355 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 1351 if (stream_) { | 1356 if (stream_) { |
| 1352 call_->DestroyAudioReceiveStream(stream_); | 1357 call_->DestroyAudioReceiveStream(stream_); |
| 1353 stream_ = nullptr; | 1358 stream_ = nullptr; |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 | 2268 |
| 2264 bool WebRtcVoiceMediaChannel::SetOutputVolume(uint32_t ssrc, double volume) { | 2269 bool WebRtcVoiceMediaChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
| 2265 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2270 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2266 if (ssrc == 0) { | 2271 if (ssrc == 0) { |
| 2267 default_recv_volume_ = volume; | 2272 default_recv_volume_ = volume; |
| 2268 if (default_recv_ssrc_ == -1) { | 2273 if (default_recv_ssrc_ == -1) { |
| 2269 return true; | 2274 return true; |
| 2270 } | 2275 } |
| 2271 ssrc = static_cast<uint32_t>(default_recv_ssrc_); | 2276 ssrc = static_cast<uint32_t>(default_recv_ssrc_); |
| 2272 } | 2277 } |
| 2273 int ch_id = GetReceiveChannelId(ssrc); | 2278 const auto it = recv_streams_.find(ssrc); |
| 2274 if (ch_id < 0) { | 2279 if (it == recv_streams_.end()) { |
| 2275 LOG(LS_WARNING) << "Cannot find channel for ssrc:" << ssrc; | 2280 LOG(LS_WARNING) << "SetOutputVolume: no recv stream" << ssrc; |
| 2276 return false; | 2281 return false; |
| 2277 } | 2282 } |
| 2278 | 2283 it->second->SetOutputVolume(volume); |
| 2279 if (-1 == engine()->voe()->volume()->SetChannelOutputVolumeScaling(ch_id, | 2284 LOG(LS_INFO) << "SetOutputVolume() to " << volume |
| 2280 volume)) { | 2285 << " for recv stream with ssrc " << ssrc; |
| 2281 LOG_RTCERR2(SetChannelOutputVolumeScaling, ch_id, volume); | |
| 2282 return false; | |
| 2283 } | |
| 2284 LOG(LS_INFO) << "SetOutputVolume to " << volume | |
| 2285 << " for channel " << ch_id << " and ssrc " << ssrc; | |
| 2286 return true; | 2286 return true; |
| 2287 } | 2287 } |
| 2288 | 2288 |
| 2289 bool WebRtcVoiceMediaChannel::CanInsertDtmf() { | 2289 bool WebRtcVoiceMediaChannel::CanInsertDtmf() { |
| 2290 return dtmf_payload_type_ ? true : false; | 2290 return dtmf_payload_type_ ? true : false; |
| 2291 } | 2291 } |
| 2292 | 2292 |
| 2293 bool WebRtcVoiceMediaChannel::InsertDtmf(uint32_t ssrc, int event, | 2293 bool WebRtcVoiceMediaChannel::InsertDtmf(uint32_t ssrc, int event, |
| 2294 int duration) { | 2294 int duration) { |
| 2295 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2295 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2607 } | 2607 } |
| 2608 } else { | 2608 } else { |
| 2609 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2609 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
| 2610 engine()->voe()->base()->StopPlayout(channel); | 2610 engine()->voe()->base()->StopPlayout(channel); |
| 2611 } | 2611 } |
| 2612 return true; | 2612 return true; |
| 2613 } | 2613 } |
| 2614 } // namespace cricket | 2614 } // namespace cricket |
| 2615 | 2615 |
| 2616 #endif // HAVE_WEBRTC_VOICE | 2616 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |