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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1256 int channel() const { | 1256 int channel() const { |
1257 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1257 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1258 return config_.voe_channel_id; | 1258 return config_.voe_channel_id; |
1259 } | 1259 } |
1260 | 1260 |
1261 void SetRawAudioSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) { | 1261 void SetRawAudioSink(std::unique_ptr<webrtc::AudioSinkInterface> sink) { |
1262 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1262 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1263 stream_->SetSink(std::move(sink)); | 1263 stream_->SetSink(std::move(sink)); |
1264 } | 1264 } |
1265 | 1265 |
1266 void SetOutputVolume(double volume) { | |
1267 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | |
1268 stream_->SetGain(volume); | |
1269 } | |
1270 | |
1266 private: | 1271 private: |
1267 void RecreateAudioReceiveStream( | 1272 void RecreateAudioReceiveStream( |
1268 bool use_transport_cc, | 1273 bool use_transport_cc, |
1269 const std::vector<webrtc::RtpExtension>& extensions) { | 1274 const std::vector<webrtc::RtpExtension>& extensions) { |
1270 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1275 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1271 if (stream_) { | 1276 if (stream_) { |
1272 call_->DestroyAudioReceiveStream(stream_); | 1277 call_->DestroyAudioReceiveStream(stream_); |
1273 stream_ = nullptr; | 1278 stream_ = nullptr; |
1274 } | 1279 } |
1275 config_.rtp.extensions = extensions; | 1280 config_.rtp.extensions = extensions; |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2197 | 2202 |
2198 bool WebRtcVoiceMediaChannel::SetOutputVolume(uint32_t ssrc, double volume) { | 2203 bool WebRtcVoiceMediaChannel::SetOutputVolume(uint32_t ssrc, double volume) { |
2199 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2204 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
2200 if (ssrc == 0) { | 2205 if (ssrc == 0) { |
2201 default_recv_volume_ = volume; | 2206 default_recv_volume_ = volume; |
2202 if (default_recv_ssrc_ == -1) { | 2207 if (default_recv_ssrc_ == -1) { |
2203 return true; | 2208 return true; |
2204 } | 2209 } |
2205 ssrc = static_cast<uint32_t>(default_recv_ssrc_); | 2210 ssrc = static_cast<uint32_t>(default_recv_ssrc_); |
2206 } | 2211 } |
2207 int ch_id = GetReceiveChannelId(ssrc); | 2212 const auto it = recv_streams_.find(ssrc); |
2208 if (ch_id < 0) { | 2213 if (it == recv_streams_.end()) { |
2209 LOG(LS_WARNING) << "Cannot find channel for ssrc:" << ssrc; | 2214 LOG(LS_WARNING) << "SetOutputVolume: no recv stream" << ssrc; |
2210 return false; | 2215 return false; |
2211 } | 2216 } |
2212 | 2217 it->second->SetOutputVolume(volume); |
2213 if (-1 == engine()->voe()->volume()->SetChannelOutputVolumeScaling(ch_id, | 2218 LOG(LS_INFO) << "SetOutputVolume() to " << volume |
2214 volume)) { | 2219 << " for recv channel with ssrc " << ssrc; |
kwiberg-webrtc
2016/06/16 09:26:53
"recv stream"?
the sun
2016/06/16 14:34:06
Done.
| |
2215 LOG_RTCERR2(SetChannelOutputVolumeScaling, ch_id, volume); | |
2216 return false; | |
2217 } | |
2218 LOG(LS_INFO) << "SetOutputVolume to " << volume | |
2219 << " for channel " << ch_id << " and ssrc " << ssrc; | |
2220 return true; | 2220 return true; |
2221 } | 2221 } |
2222 | 2222 |
2223 bool WebRtcVoiceMediaChannel::CanInsertDtmf() { | 2223 bool WebRtcVoiceMediaChannel::CanInsertDtmf() { |
2224 return dtmf_payload_type_ ? true : false; | 2224 return dtmf_payload_type_ ? true : false; |
2225 } | 2225 } |
2226 | 2226 |
2227 bool WebRtcVoiceMediaChannel::InsertDtmf(uint32_t ssrc, int event, | 2227 bool WebRtcVoiceMediaChannel::InsertDtmf(uint32_t ssrc, int event, |
2228 int duration) { | 2228 int duration) { |
2229 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2229 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2549 } | 2549 } |
2550 } else { | 2550 } else { |
2551 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2551 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
2552 engine()->voe()->base()->StopPlayout(channel); | 2552 engine()->voe()->base()->StopPlayout(channel); |
2553 } | 2553 } |
2554 return true; | 2554 return true; |
2555 } | 2555 } |
2556 } // namespace cricket | 2556 } // namespace cricket |
2557 | 2557 |
2558 #endif // HAVE_WEBRTC_VOICE | 2558 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |