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 21 matching lines...) Expand all Loading... |
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_coding/acm2/rent_a_codec.h" | 40 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" |
41 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" | 41 #include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
| 42 #include "webrtc/modules/audio_processing/aec_dump/aec_dump_factory.h" |
42 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 43 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
43 #include "webrtc/system_wrappers/include/field_trial.h" | 44 #include "webrtc/system_wrappers/include/field_trial.h" |
44 #include "webrtc/system_wrappers/include/metrics.h" | 45 #include "webrtc/system_wrappers/include/metrics.h" |
45 #include "webrtc/system_wrappers/include/trace.h" | 46 #include "webrtc/system_wrappers/include/trace.h" |
46 #include "webrtc/voice_engine/transmit_mixer.h" | 47 #include "webrtc/voice_engine/transmit_mixer.h" |
47 | 48 |
48 namespace cricket { | 49 namespace cricket { |
49 namespace { | 50 namespace { |
50 | 51 |
51 constexpr size_t kMaxUnsignaledRecvStreams = 1; | 52 constexpr size_t kMaxUnsignaledRecvStreams = 1; |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 : WebRtcVoiceEngine(adm, decoder_factory, audio_mixer, new VoEWrapper()) { | 559 : WebRtcVoiceEngine(adm, decoder_factory, audio_mixer, new VoEWrapper()) { |
559 audio_state_ = | 560 audio_state_ = |
560 webrtc::AudioState::Create(MakeAudioStateConfig(voe(), audio_mixer)); | 561 webrtc::AudioState::Create(MakeAudioStateConfig(voe(), audio_mixer)); |
561 } | 562 } |
562 | 563 |
563 WebRtcVoiceEngine::WebRtcVoiceEngine( | 564 WebRtcVoiceEngine::WebRtcVoiceEngine( |
564 webrtc::AudioDeviceModule* adm, | 565 webrtc::AudioDeviceModule* adm, |
565 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, | 566 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
566 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, | 567 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
567 VoEWrapper* voe_wrapper) | 568 VoEWrapper* voe_wrapper) |
568 : adm_(adm), decoder_factory_(decoder_factory), voe_wrapper_(voe_wrapper) { | 569 : worker_queue_("file_writer_task_queue_"), |
| 570 adm_(adm), |
| 571 decoder_factory_(decoder_factory), |
| 572 voe_wrapper_(voe_wrapper) { |
569 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 573 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
570 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; | 574 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; |
571 RTC_DCHECK(voe_wrapper); | 575 RTC_DCHECK(voe_wrapper); |
572 RTC_DCHECK(decoder_factory); | 576 RTC_DCHECK(decoder_factory); |
573 | 577 |
574 signal_thread_checker_.DetachFromThread(); | 578 signal_thread_checker_.DetachFromThread(); |
575 | 579 |
576 // Load our audio codec list. | 580 // Load our audio codec list. |
577 LOG(LS_INFO) << "Supported send codecs in order of preference:"; | 581 LOG(LS_INFO) << "Supported send codecs in order of preference:"; |
578 send_codecs_ = WebRtcVoiceCodecs::SupportedSendCodecs(); | 582 send_codecs_ = WebRtcVoiceCodecs::SupportedSendCodecs(); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 int64_t max_size_bytes) { | 996 int64_t max_size_bytes) { |
993 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 997 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
994 FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file); | 998 FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file); |
995 if (!aec_dump_file_stream) { | 999 if (!aec_dump_file_stream) { |
996 LOG(LS_ERROR) << "Could not open AEC dump file stream."; | 1000 LOG(LS_ERROR) << "Could not open AEC dump file stream."; |
997 if (!rtc::ClosePlatformFile(file)) | 1001 if (!rtc::ClosePlatformFile(file)) |
998 LOG(LS_WARNING) << "Could not close file."; | 1002 LOG(LS_WARNING) << "Could not close file."; |
999 return false; | 1003 return false; |
1000 } | 1004 } |
1001 StopAecDump(); | 1005 StopAecDump(); |
1002 if (apm()->StartDebugRecording(aec_dump_file_stream, max_size_bytes) != | 1006 apm()->StartDebugRecording(webrtc::AecDumpFactory::Create( |
1003 webrtc::AudioProcessing::kNoError) { | 1007 aec_dump_file_stream, max_size_bytes, &worker_queue_)); |
1004 LOG_RTCERR0(StartDebugRecording); | |
1005 fclose(aec_dump_file_stream); | |
1006 return false; | |
1007 } | |
1008 is_dumping_aec_ = true; | 1008 is_dumping_aec_ = true; |
1009 return true; | 1009 return true; |
1010 } | 1010 } |
1011 | 1011 |
1012 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) { | 1012 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) { |
1013 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1013 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1014 if (!is_dumping_aec_) { | 1014 if (!is_dumping_aec_) { |
1015 // Start dumping AEC when we are not dumping. | 1015 // Start dumping AEC when we are not dumping. |
1016 if (apm()->StartDebugRecording(filename.c_str(), -1) != | 1016 apm()->StartDebugRecording( |
1017 webrtc::AudioProcessing::kNoError) { | 1017 webrtc::AecDumpFactory::Create(filename.c_str(), -1, &worker_queue_)); |
1018 LOG_RTCERR1(StartDebugRecording, filename.c_str()); | 1018 is_dumping_aec_ = true; |
1019 } else { | |
1020 is_dumping_aec_ = true; | |
1021 } | |
1022 } | 1019 } |
1023 } | 1020 } |
1024 | 1021 |
1025 void WebRtcVoiceEngine::StopAecDump() { | 1022 void WebRtcVoiceEngine::StopAecDump() { |
1026 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1023 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1027 if (is_dumping_aec_) { | 1024 if (is_dumping_aec_) { |
1028 // Stop dumping AEC when we are dumping. | 1025 // Stop dumping AEC when we are dumping. |
1029 if (apm()->StopDebugRecording() != webrtc::AudioProcessing::kNoError) { | 1026 apm()->StopDebugRecording(); |
1030 LOG_RTCERR0(StopDebugRecording); | |
1031 } | |
1032 is_dumping_aec_ = false; | 1027 is_dumping_aec_ = false; |
1033 } | 1028 } |
1034 } | 1029 } |
1035 | 1030 |
1036 int WebRtcVoiceEngine::CreateVoEChannel() { | 1031 int WebRtcVoiceEngine::CreateVoEChannel() { |
1037 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 1032 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
1038 return voe_wrapper_->base()->CreateChannel(channel_config_); | 1033 return voe_wrapper_->base()->CreateChannel(channel_config_); |
1039 } | 1034 } |
1040 | 1035 |
1041 webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() { | 1036 webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() { |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2626 ssrc); | 2621 ssrc); |
2627 if (it != unsignaled_recv_ssrcs_.end()) { | 2622 if (it != unsignaled_recv_ssrcs_.end()) { |
2628 unsignaled_recv_ssrcs_.erase(it); | 2623 unsignaled_recv_ssrcs_.erase(it); |
2629 return true; | 2624 return true; |
2630 } | 2625 } |
2631 return false; | 2626 return false; |
2632 } | 2627 } |
2633 } // namespace cricket | 2628 } // namespace cricket |
2634 | 2629 |
2635 #endif // HAVE_WEBRTC_VOICE | 2630 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |