Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Unified Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2896813002: Activate 'offload debug dump recordings from audio thread to TaskQueue'. (Closed)
Patch Set: Adding strict mock expectations. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvoiceengine.cc
diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc
index 2b0f72aef1ff5ee8786f5a73e0a0e58d4f29147b..fa4dad0f156b6b204f968c6f43c111182eb033ba 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) {
@@ -657,46 +660,27 @@ 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;
+ auto aec_dump = webrtc::AecDumpFactory::Create(file, max_size_bytes,
+ &low_priority_worker_queue_);
+ if (aec_dump) {
+ apm()->AttachAecDump(std::move(aec_dump));
}
- StopAecDump();
- if (apm()->StartDebugRecording(aec_dump_file_stream, max_size_bytes) !=
- webrtc::AudioProcessing::kNoError) {
- LOG_RTCERR0(StartDebugRecording);
- fclose(aec_dump_file_stream);
- return false;
- }
- is_dumping_aec_ = true;
- return true;
+ 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
}
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() {

Powered by Google App Engine
This is Rietveld 408576698