Revert of Activate 'offload debug dump recordings from audio thread to TaskQueue'. (patchset #4 id:160001 of https://codereview.webrtc.org/2896813002/ )

Reason for revert:
Breaks internal project.

Original issue's description:
> Activate 'offload debug dump recordings from audio thread to TaskQueue'.
>
> A low priority task queue is added to WebRTCVoiceEngine. The
> start/stop debug calls make file logging happen on the task queue.
>
> In a dependent CL (https://codereview.webrtc.org/2888303003), the task queue is moved to PeerConnectionFactory,
> so that it can be shared for low priority tasks between different
> subcomponents. It will require some changes to MediaEngine,
> CompositeMediaEngine, WebRTCVoiceEngine, and changes in internal
> projects.
>
> A task queue must be created and destroyed from the same thread. With
> this CL that will be the worker thread, which creates and destroys
> WebRTCVoiceEngine. With the dependent CL, it will probably change to
> the signaling thread.
>
> NOTRY=True # tests just passed
>
> BUG=webrtc:7404
>
> Review-Url: https://codereview.webrtc.org/2896813002
> Cr-Commit-Position: refs/heads/master@{#18252}
> Committed: c61bf947b4

TBR=solenberg@webrtc.org,tommi@webrtc.org,perkj@webrtc.org,danilchap@webrtc.org,tommi@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7404

Review-Url: https://codereview.webrtc.org/2904893002
Cr-Commit-Position: refs/heads/master@{#18255}
This commit is contained in:
aleloi 2017-05-24 04:19:54 -07:00 committed by Commit bot
parent 0afb13014b
commit be68b72cfa
4 changed files with 29 additions and 25 deletions

View File

@ -220,11 +220,6 @@ rtc_static_library("rtc_media") {
public_configs += [ ":rtc_media_defines_config" ]
deps += [ "../modules/video_capture:video_capture_internal_impl" ]
}
if (rtc_enable_protobuf) {
deps += [ "../modules/audio_processing/aec_dump:aec_dump_impl" ]
} else {
deps += [ "../modules/audio_processing/aec_dump:null_aec_dump_factory" ]
}
deps += [
":rtc_media_base",
"..:webrtc_common",
@ -242,7 +237,6 @@ rtc_static_library("rtc_media") {
"../modules/audio_device:audio_device",
"../modules/audio_mixer:audio_mixer_impl",
"../modules/audio_processing:audio_processing",
"../modules/audio_processing/aec_dump",
"../modules/video_capture:video_capture_module",
"../modules/video_coding",
"../modules/video_coding:webrtc_h264",

View File

@ -38,7 +38,6 @@
#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"
@ -229,8 +228,7 @@ WebRtcVoiceEngine::WebRtcVoiceEngine(
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
VoEWrapper* voe_wrapper)
: low_priority_worker_queue_("rtc-low-prio", rtc::TaskQueue::Priority::LOW),
adm_(adm),
: adm_(adm),
encoder_factory_(encoder_factory),
decoder_factory_(decoder_factory),
voe_wrapper_(voe_wrapper) {
@ -689,28 +687,46 @@ void WebRtcVoiceEngine::UnregisterChannel(WebRtcVoiceMediaChannel* channel) {
bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file,
int64_t max_size_bytes) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
auto aec_dump = webrtc::AecDumpFactory::Create(file, max_size_bytes,
&low_priority_worker_queue_);
if (!aec_dump) {
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;
}
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;
}
void WebRtcVoiceEngine::StartAecDump(const std::string& filename) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
auto aec_dump =
webrtc::AecDumpFactory::Create(filename, -1, &low_priority_worker_queue_);
if (aec_dump) {
apm()->AttachAecDump(std::move(aec_dump));
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;
}
}
}
void WebRtcVoiceEngine::StopAecDump() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
apm()->DetachAecDump();
if (is_dumping_aec_) {
// Stop dumping AEC when we are dumping.
if (apm()->StopDebugRecording() != webrtc::AudioProcessing::kNoError) {
LOG_RTCERR0(StopDebugRecording);
}
is_dumping_aec_ = false;
}
}
int WebRtcVoiceEngine::CreateVoEChannel() {

View File

@ -22,7 +22,6 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/networkroute.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/task_queue.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/call/audio_state.h"
#include "webrtc/call/call.h"
@ -111,9 +110,6 @@ class WebRtcVoiceEngine final : public webrtc::TraceCallback {
void StartAecDump(const std::string& filename);
int CreateVoEChannel();
rtc::TaskQueue low_priority_worker_queue_;
webrtc::AudioDeviceModule* adm();
webrtc::AudioProcessing* apm();
webrtc::voe::TransmitMixer* transmit_mixer();

View File

@ -125,7 +125,6 @@ TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) {
EXPECT_CALL(apm, ApplyConfig(testing::_));
EXPECT_CALL(apm, SetExtraOptions(testing::_));
EXPECT_CALL(apm, Initialize()).WillOnce(Return(0));
EXPECT_CALL(apm, DetachAecDump());
StrictMock<MockTransmitMixer> transmit_mixer;
EXPECT_CALL(transmit_mixer, EnableStereoChannelSwapping(false));
cricket::FakeWebRtcVoiceEngine voe(&apm, &transmit_mixer);
@ -164,7 +163,6 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
EXPECT_CALL(apm_, ApplyConfig(testing::_));
EXPECT_CALL(apm_, SetExtraOptions(testing::_));
EXPECT_CALL(apm_, Initialize()).WillOnce(Return(0));
EXPECT_CALL(apm_, DetachAecDump());
// Default Options.
EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0));
EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0));