From 797ef123249f793655640e8cb6ff1eb4fe7e3223 Mon Sep 17 00:00:00 2001 From: ivoc Date: Thu, 22 Oct 2015 03:25:41 -0700 Subject: [PATCH] Added StopAecDump function to PeerConnectionFactory. The function to stop recording an AEC dump was missing from the PeerConnectionFactory interface (only a start function was provided). This CL adds the missing stop function. BUG=webrtc:4741 Review URL: https://codereview.webrtc.org/1415733005 Cr-Commit-Position: refs/heads/master@{#10372} --- talk/app/webrtc/peerconnectionfactory.cc | 5 +++++ talk/app/webrtc/peerconnectionfactory.h | 1 + talk/app/webrtc/peerconnectionfactoryproxy.h | 1 + talk/app/webrtc/peerconnectioninterface.h | 3 +++ talk/media/base/fakemediaengine.h | 2 ++ talk/media/base/mediaengine.h | 7 +++++++ talk/media/webrtc/webrtcvoiceengine.h | 4 +++- talk/session/media/channelmanager.cc | 5 +++++ talk/session/media/channelmanager.h | 3 +++ 9 files changed, 30 insertions(+), 1 deletion(-) diff --git a/talk/app/webrtc/peerconnectionfactory.cc b/talk/app/webrtc/peerconnectionfactory.cc index 54a32bc7b8..b46b4b68d3 100644 --- a/talk/app/webrtc/peerconnectionfactory.cc +++ b/talk/app/webrtc/peerconnectionfactory.cc @@ -218,6 +218,11 @@ bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file) { return channel_manager_->StartAecDump(file); } +void PeerConnectionFactory::StopAecDump() { + RTC_DCHECK(signaling_thread_->IsCurrent()); + channel_manager_->StopAecDump(); +} + bool PeerConnectionFactory::StartRtcEventLog(rtc::PlatformFile file) { RTC_DCHECK(signaling_thread_->IsCurrent()); return channel_manager_->StartRtcEventLog(file); diff --git a/talk/app/webrtc/peerconnectionfactory.h b/talk/app/webrtc/peerconnectionfactory.h index f8e0a40de2..af4117a9d3 100644 --- a/talk/app/webrtc/peerconnectionfactory.h +++ b/talk/app/webrtc/peerconnectionfactory.h @@ -80,6 +80,7 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface { AudioSourceInterface* audio_source) override; bool StartAecDump(rtc::PlatformFile file) override; + void StopAecDump() override; bool StartRtcEventLog(rtc::PlatformFile file) override; void StopRtcEventLog() override; diff --git a/talk/app/webrtc/peerconnectionfactoryproxy.h b/talk/app/webrtc/peerconnectionfactoryproxy.h index 826d57758c..5e924df3a1 100644 --- a/talk/app/webrtc/peerconnectionfactoryproxy.h +++ b/talk/app/webrtc/peerconnectionfactoryproxy.h @@ -62,6 +62,7 @@ BEGIN_PROXY_MAP(PeerConnectionFactory) PROXY_METHOD2(rtc::scoped_refptr, CreateAudioTrack, const std::string&, AudioSourceInterface*) PROXY_METHOD1(bool, StartAecDump, rtc::PlatformFile) + PROXY_METHOD0(void, StopAecDump) PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile) PROXY_METHOD0(void, StopRtcEventLog) diff --git a/talk/app/webrtc/peerconnectioninterface.h b/talk/app/webrtc/peerconnectioninterface.h index a5d98ffa74..77caa9d78b 100644 --- a/talk/app/webrtc/peerconnectioninterface.h +++ b/talk/app/webrtc/peerconnectioninterface.h @@ -621,6 +621,9 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface { // http://crbug.com/264611. virtual bool StartAecDump(rtc::PlatformFile file) = 0; + // Stops logging the AEC dump. + virtual void StopAecDump() = 0; + // Starts RtcEventLog using existing file. Takes ownership of |file| and // passes it on to VoiceEngine, which will take the ownership. If the // operation fails the file will be closed. The logging will stop diff --git a/talk/media/base/fakemediaengine.h b/talk/media/base/fakemediaengine.h index 5a4f46a204..a6fa960dee 100644 --- a/talk/media/base/fakemediaengine.h +++ b/talk/media/base/fakemediaengine.h @@ -785,6 +785,8 @@ class FakeVoiceEngine : public FakeBaseEngine { bool StartAecDump(rtc::PlatformFile file) { return false; } + void StopAecDump() {} + bool StartRtcEventLog(rtc::PlatformFile file) { return false; } void StopRtcEventLog() {} diff --git a/talk/media/base/mediaengine.h b/talk/media/base/mediaengine.h index c5b90962f9..1a992d7d4a 100644 --- a/talk/media/base/mediaengine.h +++ b/talk/media/base/mediaengine.h @@ -122,6 +122,9 @@ class MediaEngineInterface { // Starts AEC dump using existing file. virtual bool StartAecDump(rtc::PlatformFile file) = 0; + // Stops recording AEC dump. + virtual void StopAecDump() = 0; + // Starts RtcEventLog using existing file. virtual bool StartRtcEventLog(rtc::PlatformFile file) = 0; @@ -225,6 +228,10 @@ class CompositeMediaEngine : public MediaEngineInterface { return voice_.StartAecDump(file); } + virtual void StopAecDump() { + voice_.StopAecDump(); + } + virtual bool StartRtcEventLog(rtc::PlatformFile file) { return voice_.StartRtcEventLog(file); } diff --git a/talk/media/webrtc/webrtcvoiceengine.h b/talk/media/webrtc/webrtcvoiceengine.h index a70840565b..1cf05e71a2 100644 --- a/talk/media/webrtc/webrtcvoiceengine.h +++ b/talk/media/webrtc/webrtcvoiceengine.h @@ -108,6 +108,9 @@ class WebRtcVoiceEngine // Starts AEC dump using existing file. bool StartAecDump(rtc::PlatformFile file); + // Stops AEC dump. + void StopAecDump(); + // Starts recording an RtcEventLog using an existing file until 10 minutes // pass or the StopRtcEventLog function is called. bool StartRtcEventLog(rtc::PlatformFile file); @@ -139,7 +142,6 @@ class WebRtcVoiceEngine bool is_input, const std::string& dev_name, int dev_id, int* rtc_id); void StartAecDump(const std::string& filename); - void StopAecDump(); int CreateVoEChannel(); static const int kDefaultLogSeverity = rtc::LS_WARNING; diff --git a/talk/session/media/channelmanager.cc b/talk/session/media/channelmanager.cc index 5caf3c4b57..e7e1cd44a2 100644 --- a/talk/session/media/channelmanager.cc +++ b/talk/session/media/channelmanager.cc @@ -630,6 +630,11 @@ bool ChannelManager::StartAecDump(rtc::PlatformFile file) { Bind(&MediaEngineInterface::StartAecDump, media_engine_.get(), file)); } +void ChannelManager::StopAecDump() { + worker_thread_->Invoke( + Bind(&MediaEngineInterface::StopAecDump, media_engine_.get())); +} + bool ChannelManager::StartRtcEventLog(rtc::PlatformFile file) { return worker_thread_->Invoke( Bind(&MediaEngineInterface::StartRtcEventLog, media_engine_.get(), file)); diff --git a/talk/session/media/channelmanager.h b/talk/session/media/channelmanager.h index 2417662452..6312e61e06 100644 --- a/talk/session/media/channelmanager.h +++ b/talk/session/media/channelmanager.h @@ -170,6 +170,9 @@ class ChannelManager : public rtc::MessageHandler, // Starts AEC dump using existing file. bool StartAecDump(rtc::PlatformFile file); + // Stops recording AEC dump. + void StopAecDump(); + // Starts RtcEventLog using existing file. bool StartRtcEventLog(rtc::PlatformFile file);