Index: webrtc/media/engine/webrtcvoiceengine.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc |
index 210313896004d2efd39484b2aaa52a43138b94d1..823b13e91d6d2d8b193388e8468006471b38fc98 100644 |
--- a/webrtc/media/engine/webrtcvoiceengine.cc |
+++ b/webrtc/media/engine/webrtcvoiceengine.cc |
@@ -38,6 +38,7 @@ |
#include "webrtc/media/engine/webrtcmediaengine.h" |
#include "webrtc/media/engine/webrtcvoe.h" |
#include "webrtc/modules/audio_mixer/audio_mixer_impl.h" |
+#include "webrtc/modules/audio_processing/aec_dump/aec_dump_factory.h" |
#include "webrtc/modules/audio_processing/include/audio_processing.h" |
#include "webrtc/system_wrappers/include/field_trial.h" |
#include "webrtc/system_wrappers/include/metrics.h" |
@@ -228,7 +229,9 @@ WebRtcVoiceEngine::WebRtcVoiceEngine( |
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, |
VoEWrapper* voe_wrapper) |
- : adm_(adm), |
+ : low_priority_worker_queue_("low-prio-worker-queue", |
+ rtc::TaskQueue::Priority::LOW), |
+ adm_(adm), |
encoder_factory_(encoder_factory), |
decoder_factory_(decoder_factory), |
voe_wrapper_(voe_wrapper) { |
@@ -687,46 +690,28 @@ void WebRtcVoiceEngine::UnregisterChannel(WebRtcVoiceMediaChannel* channel) { |
bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file, |
int64_t max_size_bytes) { |
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
- FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file); |
- if (!aec_dump_file_stream) { |
- LOG(LS_ERROR) << "Could not open AEC dump file stream."; |
- if (!rtc::ClosePlatformFile(file)) |
- LOG(LS_WARNING) << "Could not close file."; |
- return false; |
- } |
- StopAecDump(); |
- if (apm()->StartDebugRecording(aec_dump_file_stream, max_size_bytes) != |
- webrtc::AudioProcessing::kNoError) { |
- LOG_RTCERR0(StartDebugRecording); |
- fclose(aec_dump_file_stream); |
- return false; |
+ auto aec_dump = webrtc::AecDumpFactory::Create(file, max_size_bytes, |
+ &low_priority_worker_queue_); |
+ if (!aec_dump) { |
+ return true; |
the sun
2017/05/23 20:47:29
did you mean 'false'?
|
} |
- is_dumping_aec_ = true; |
+ apm()->AttachAecDump(std::move(aec_dump)); |
return true; |
} |
void WebRtcVoiceEngine::StartAecDump(const std::string& filename) { |
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
- if (!is_dumping_aec_) { |
- // Start dumping AEC when we are not dumping. |
- if (apm()->StartDebugRecording(filename.c_str(), -1) != |
- webrtc::AudioProcessing::kNoError) { |
- LOG_RTCERR1(StartDebugRecording, filename.c_str()); |
- } else { |
- is_dumping_aec_ = true; |
- } |
+ |
+ auto aec_dump = |
+ webrtc::AecDumpFactory::Create(filename, -1, &low_priority_worker_queue_); |
+ if (aec_dump) { |
+ apm()->AttachAecDump(std::move(aec_dump)); |
} |
} |
void WebRtcVoiceEngine::StopAecDump() { |
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
- if (is_dumping_aec_) { |
- // Stop dumping AEC when we are dumping. |
- if (apm()->StopDebugRecording() != webrtc::AudioProcessing::kNoError) { |
- LOG_RTCERR0(StopDebugRecording); |
- } |
- is_dumping_aec_ = false; |
- } |
+ apm()->DetachAecDump(); |
} |
int WebRtcVoiceEngine::CreateVoEChannel() { |