Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 #include "webrtc/base/trace_event.h" | 31 #include "webrtc/base/trace_event.h" |
| 32 #include "webrtc/media/base/audiosource.h" | 32 #include "webrtc/media/base/audiosource.h" |
| 33 #include "webrtc/media/base/mediaconstants.h" | 33 #include "webrtc/media/base/mediaconstants.h" |
| 34 #include "webrtc/media/base/streamparams.h" | 34 #include "webrtc/media/base/streamparams.h" |
| 35 #include "webrtc/media/engine/adm_helpers.h" | 35 #include "webrtc/media/engine/adm_helpers.h" |
| 36 #include "webrtc/media/engine/apm_helpers.h" | 36 #include "webrtc/media/engine/apm_helpers.h" |
| 37 #include "webrtc/media/engine/payload_type_mapper.h" | 37 #include "webrtc/media/engine/payload_type_mapper.h" |
| 38 #include "webrtc/media/engine/webrtcmediaengine.h" | 38 #include "webrtc/media/engine/webrtcmediaengine.h" |
| 39 #include "webrtc/media/engine/webrtcvoe.h" | 39 #include "webrtc/media/engine/webrtcvoe.h" |
| 40 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 40 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
| 41 #include "webrtc/modules/audio_processing/aec_dump/aec_dump_factory.h" | |
| 41 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 42 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 42 #include "webrtc/system_wrappers/include/field_trial.h" | 43 #include "webrtc/system_wrappers/include/field_trial.h" |
| 43 #include "webrtc/system_wrappers/include/metrics.h" | 44 #include "webrtc/system_wrappers/include/metrics.h" |
| 44 #include "webrtc/system_wrappers/include/trace.h" | 45 #include "webrtc/system_wrappers/include/trace.h" |
| 45 #include "webrtc/voice_engine/transmit_mixer.h" | 46 #include "webrtc/voice_engine/transmit_mixer.h" |
| 46 | 47 |
| 47 namespace cricket { | 48 namespace cricket { |
| 48 namespace { | 49 namespace { |
| 49 | 50 |
| 50 constexpr size_t kMaxUnsignaledRecvStreams = 1; | 51 constexpr size_t kMaxUnsignaledRecvStreams = 1; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 audio_state_ = | 222 audio_state_ = |
| 222 webrtc::AudioState::Create(MakeAudioStateConfig(voe(), audio_mixer)); | 223 webrtc::AudioState::Create(MakeAudioStateConfig(voe(), audio_mixer)); |
| 223 } | 224 } |
| 224 | 225 |
| 225 WebRtcVoiceEngine::WebRtcVoiceEngine( | 226 WebRtcVoiceEngine::WebRtcVoiceEngine( |
| 226 webrtc::AudioDeviceModule* adm, | 227 webrtc::AudioDeviceModule* adm, |
| 227 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, | 228 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory, |
| 228 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, | 229 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
| 229 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, | 230 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
| 230 VoEWrapper* voe_wrapper) | 231 VoEWrapper* voe_wrapper) |
| 231 : adm_(adm), | 232 : low_priority_worker_queue_("low-prio-worker-queue", |
| 233 rtc::TaskQueue::Priority::LOW), | |
| 234 adm_(adm), | |
| 232 encoder_factory_(encoder_factory), | 235 encoder_factory_(encoder_factory), |
| 233 decoder_factory_(decoder_factory), | 236 decoder_factory_(decoder_factory), |
| 234 voe_wrapper_(voe_wrapper) { | 237 voe_wrapper_(voe_wrapper) { |
| 235 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 238 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 236 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; | 239 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; |
| 237 RTC_DCHECK(voe_wrapper); | 240 RTC_DCHECK(voe_wrapper); |
| 238 RTC_DCHECK(decoder_factory); | 241 RTC_DCHECK(decoder_factory); |
| 239 | 242 |
| 240 signal_thread_checker_.DetachFromThread(); | 243 signal_thread_checker_.DetachFromThread(); |
| 241 | 244 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 650 void WebRtcVoiceEngine::UnregisterChannel(WebRtcVoiceMediaChannel* channel) { | 653 void WebRtcVoiceEngine::UnregisterChannel(WebRtcVoiceMediaChannel* channel) { |
| 651 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 654 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 652 auto it = std::find(channels_.begin(), channels_.end(), channel); | 655 auto it = std::find(channels_.begin(), channels_.end(), channel); |
| 653 RTC_DCHECK(it != channels_.end()); | 656 RTC_DCHECK(it != channels_.end()); |
| 654 channels_.erase(it); | 657 channels_.erase(it); |
| 655 } | 658 } |
| 656 | 659 |
| 657 bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file, | 660 bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file, |
| 658 int64_t max_size_bytes) { | 661 int64_t max_size_bytes) { |
| 659 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 662 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 660 FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file); | 663 auto aec_dump = webrtc::AecDumpFactory::Create(file, max_size_bytes, |
| 661 if (!aec_dump_file_stream) { | 664 &low_priority_worker_queue_); |
| 662 LOG(LS_ERROR) << "Could not open AEC dump file stream."; | 665 if (aec_dump) { |
| 663 if (!rtc::ClosePlatformFile(file)) | 666 apm()->AttachAecDump(std::move(aec_dump)); |
| 664 LOG(LS_WARNING) << "Could not close file."; | |
| 665 return false; | |
| 666 } | 667 } |
| 667 StopAecDump(); | 668 return !!aec_dump; |
|
the sun
2017/05/22 22:38:00
since you have moved from aec_dump at this point,
aleloi
2017/05/23 11:05:49
I don't know what I was thinking...
Thanks! This
| |
| 668 if (apm()->StartDebugRecording(aec_dump_file_stream, max_size_bytes) != | |
| 669 webrtc::AudioProcessing::kNoError) { | |
| 670 LOG_RTCERR0(StartDebugRecording); | |
| 671 fclose(aec_dump_file_stream); | |
| 672 return false; | |
| 673 } | |
| 674 is_dumping_aec_ = true; | |
| 675 return true; | |
| 676 } | 669 } |
| 677 | 670 |
| 678 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) { | 671 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) { |
| 679 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 672 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 680 if (!is_dumping_aec_) { | 673 |
| 681 // Start dumping AEC when we are not dumping. | 674 auto aec_dump = |
| 682 if (apm()->StartDebugRecording(filename.c_str(), -1) != | 675 webrtc::AecDumpFactory::Create(filename, -1, &low_priority_worker_queue_); |
| 683 webrtc::AudioProcessing::kNoError) { | 676 if (aec_dump) { |
| 684 LOG_RTCERR1(StartDebugRecording, filename.c_str()); | 677 apm()->AttachAecDump(std::move(aec_dump)); |
| 685 } else { | |
| 686 is_dumping_aec_ = true; | |
| 687 } | |
| 688 } | 678 } |
| 689 } | 679 } |
| 690 | 680 |
| 691 void WebRtcVoiceEngine::StopAecDump() { | 681 void WebRtcVoiceEngine::StopAecDump() { |
| 692 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 682 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 693 if (is_dumping_aec_) { | 683 apm()->DetachAecDump(); |
| 694 // Stop dumping AEC when we are dumping. | |
| 695 if (apm()->StopDebugRecording() != webrtc::AudioProcessing::kNoError) { | |
| 696 LOG_RTCERR0(StopDebugRecording); | |
| 697 } | |
| 698 is_dumping_aec_ = false; | |
| 699 } | |
| 700 } | 684 } |
| 701 | 685 |
| 702 int WebRtcVoiceEngine::CreateVoEChannel() { | 686 int WebRtcVoiceEngine::CreateVoEChannel() { |
| 703 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 687 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 704 return voe_wrapper_->base()->CreateChannel(channel_config_); | 688 return voe_wrapper_->base()->CreateChannel(channel_config_); |
| 705 } | 689 } |
| 706 | 690 |
| 707 webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() { | 691 webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() { |
| 708 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 692 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 709 RTC_DCHECK(adm_); | 693 RTC_DCHECK(adm_); |
| (...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2327 ssrc); | 2311 ssrc); |
| 2328 if (it != unsignaled_recv_ssrcs_.end()) { | 2312 if (it != unsignaled_recv_ssrcs_.end()) { |
| 2329 unsignaled_recv_ssrcs_.erase(it); | 2313 unsignaled_recv_ssrcs_.erase(it); |
| 2330 return true; | 2314 return true; |
| 2331 } | 2315 } |
| 2332 return false; | 2316 return false; |
| 2333 } | 2317 } |
| 2334 } // namespace cricket | 2318 } // namespace cricket |
| 2335 | 2319 |
| 2336 #endif // HAVE_WEBRTC_VOICE | 2320 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |