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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1148 webrtc::Call* call, | 1148 webrtc::Call* call, |
1149 webrtc::Transport* send_transport) | 1149 webrtc::Transport* send_transport) |
1150 : voe_audio_transport_(voe_audio_transport), | 1150 : voe_audio_transport_(voe_audio_transport), |
1151 call_(call), | 1151 call_(call), |
1152 config_(send_transport), | 1152 config_(send_transport), |
1153 rtp_parameters_(CreateRtpParametersWithOneEncoding()) { | 1153 rtp_parameters_(CreateRtpParametersWithOneEncoding()) { |
1154 RTC_DCHECK_GE(ch, 0); | 1154 RTC_DCHECK_GE(ch, 0); |
1155 // TODO(solenberg): Once we're not using FakeWebRtcVoiceEngine anymore: | 1155 // TODO(solenberg): Once we're not using FakeWebRtcVoiceEngine anymore: |
1156 // RTC_DCHECK(voe_audio_transport); | 1156 // RTC_DCHECK(voe_audio_transport); |
1157 RTC_DCHECK(call); | 1157 RTC_DCHECK(call); |
1158 audio_capture_thread_checker_.DetachFromThread(); | |
1159 config_.rtp.ssrc = ssrc; | 1158 config_.rtp.ssrc = ssrc; |
1160 config_.rtp.c_name = c_name; | 1159 config_.rtp.c_name = c_name; |
1161 config_.voe_channel_id = ch; | 1160 config_.voe_channel_id = ch; |
1162 config_.rtp.extensions = extensions; | 1161 config_.rtp.extensions = extensions; |
1163 RecreateAudioSendStream(send_codec_spec); | 1162 RecreateAudioSendStream(send_codec_spec); |
1164 } | 1163 } |
1165 | 1164 |
1166 ~WebRtcAudioSendStream() override { | 1165 ~WebRtcAudioSendStream() override { |
1167 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1166 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1168 ClearSource(); | 1167 ClearSource(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1263 UpdateSendState(); | 1262 UpdateSendState(); |
1264 } | 1263 } |
1265 | 1264 |
1266 // AudioSource::Sink implementation. | 1265 // AudioSource::Sink implementation. |
1267 // This method is called on the audio thread. | 1266 // This method is called on the audio thread. |
1268 void OnData(const void* audio_data, | 1267 void OnData(const void* audio_data, |
1269 int bits_per_sample, | 1268 int bits_per_sample, |
1270 int sample_rate, | 1269 int sample_rate, |
1271 size_t number_of_channels, | 1270 size_t number_of_channels, |
1272 size_t number_of_frames) override { | 1271 size_t number_of_frames) override { |
1273 RTC_DCHECK(audio_capture_thread_checker_.CalledOnValidThread()); | 1272 RTC_DCHECK_NON_REENTRANT(audio_capture_non_reentrant_checker_); |
1274 RTC_DCHECK(voe_audio_transport_); | 1273 RTC_DCHECK(voe_audio_transport_); |
1275 voe_audio_transport_->PushCaptureData(config_.voe_channel_id, audio_data, | 1274 voe_audio_transport_->PushCaptureData(config_.voe_channel_id, audio_data, |
1276 bits_per_sample, sample_rate, | 1275 bits_per_sample, sample_rate, |
1277 number_of_channels, number_of_frames); | 1276 number_of_channels, number_of_frames); |
1278 } | 1277 } |
1279 | 1278 |
1280 // Callback from the |source_| when it is going away. In case Start() has | 1279 // Callback from the |source_| when it is going away. In case Start() has |
1281 // never been called, this callback won't be triggered. | 1280 // never been called, this callback won't be triggered. |
1282 void OnClose() override { | 1281 void OnClose() override { |
1283 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1282 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
(...skipping 26 matching lines...) Expand all Loading... | |
1310 RTC_DCHECK(stream_); | 1309 RTC_DCHECK(stream_); |
1311 RTC_DCHECK_EQ(1UL, rtp_parameters_.encodings.size()); | 1310 RTC_DCHECK_EQ(1UL, rtp_parameters_.encodings.size()); |
1312 if (send_ && source_ != nullptr && rtp_parameters_.encodings[0].active) { | 1311 if (send_ && source_ != nullptr && rtp_parameters_.encodings[0].active) { |
1313 stream_->Start(); | 1312 stream_->Start(); |
1314 } else { // !send || source_ = nullptr | 1313 } else { // !send || source_ = nullptr |
1315 stream_->Stop(); | 1314 stream_->Stop(); |
1316 } | 1315 } |
1317 } | 1316 } |
1318 | 1317 |
1319 rtc::ThreadChecker worker_thread_checker_; | 1318 rtc::ThreadChecker worker_thread_checker_; |
1320 rtc::ThreadChecker audio_capture_thread_checker_; | 1319 rtc::NonReentrantChecker audio_capture_non_reentrant_checker_; |
kwiberg-webrtc
2016/09/20 10:55:22
That you can change the name of the checker withou
| |
1321 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; | 1320 webrtc::AudioTransport* const voe_audio_transport_ = nullptr; |
1322 webrtc::Call* call_ = nullptr; | 1321 webrtc::Call* call_ = nullptr; |
1323 webrtc::AudioSendStream::Config config_; | 1322 webrtc::AudioSendStream::Config config_; |
1324 // The stream is owned by WebRtcAudioSendStream and may be reallocated if | 1323 // The stream is owned by WebRtcAudioSendStream and may be reallocated if |
1325 // configuration changes. | 1324 // configuration changes. |
1326 webrtc::AudioSendStream* stream_ = nullptr; | 1325 webrtc::AudioSendStream* stream_ = nullptr; |
1327 | 1326 |
1328 // Raw pointer to AudioSource owned by LocalAudioTrackHandler. | 1327 // Raw pointer to AudioSource owned by LocalAudioTrackHandler. |
1329 // PeerConnection will make sure invalidating the pointer before the object | 1328 // PeerConnection will make sure invalidating the pointer before the object |
1330 // goes away. | 1329 // goes away. |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2660 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2659 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
2661 const auto it = send_streams_.find(ssrc); | 2660 const auto it = send_streams_.find(ssrc); |
2662 if (it != send_streams_.end()) { | 2661 if (it != send_streams_.end()) { |
2663 return it->second->channel(); | 2662 return it->second->channel(); |
2664 } | 2663 } |
2665 return -1; | 2664 return -1; |
2666 } | 2665 } |
2667 } // namespace cricket | 2666 } // namespace cricket |
2668 | 2667 |
2669 #endif // HAVE_WEBRTC_VOICE | 2668 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |