Reland "Added option to specify a maximum file size when recording an AEC dump.", commit ae2c5ad12afc8cc29fe9c59dea432b697b871a87.

The revert of the original CL was commit 36d4c545007129446e551c45c17b25377dce89a4.
Original review: https://codereview.webrtc.org/1413483003/

The original CL changes a function on audio_processing.h that is used by Chrome, this CL adds back the old function.

TBR=glaznev@webrtc.org, henrik.lundin@webrtc.org, solenberg@google.com, henrikg@webrtc.org, perkj@webrtc.org
BUG=webrtc:4741
Committed: https://crrev.com/f4f5cb09277d5ef6aeac8341e5f54a055867803a
Cr-Commit-Position: refs/heads/master@{#11093}

Review URL: https://codereview.webrtc.org/1540103002

Cr-Commit-Position: refs/heads/master@{#11267}
This commit is contained in:
ivoc
2016-01-15 03:06:36 -08:00
committed by Commit bot
parent 74e8df81ae
commit d66b44d565
22 changed files with 142 additions and 60 deletions

View File

@ -1306,11 +1306,12 @@ JOW(jlong, PeerConnectionFactory_nativeCreateAudioTrack)(
}
JOW(jboolean, PeerConnectionFactory_nativeStartAecDump)(
JNIEnv* jni, jclass, jlong native_factory, jint file) {
JNIEnv* jni, jclass, jlong native_factory, jint file,
jint filesize_limit_bytes) {
#if defined(ANDROID)
rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
factoryFromJava(native_factory));
return factory->StartAecDump(file);
return factory->StartAecDump(file, filesize_limit_bytes);
#else
return false;
#endif

View File

@ -148,8 +148,8 @@ public class PeerConnectionFactory {
// Starts recording an AEC dump. Ownership of the file is transfered to the
// native code. If an AEC dump is already in progress, it will be stopped and
// a new one will start using the provided file.
public boolean startAecDump(int file_descriptor) {
return nativeStartAecDump(nativeFactory, file_descriptor);
public boolean startAecDump(int file_descriptor, int filesize_limit_bytes) {
return nativeStartAecDump(nativeFactory, file_descriptor, filesize_limit_bytes);
}
// Stops recording an AEC dump. If no AEC dump is currently being recorded,
@ -256,7 +256,8 @@ public class PeerConnectionFactory {
private static native long nativeCreateAudioTrack(
long nativeFactory, String id, long nativeSource);
private static native boolean nativeStartAecDump(long nativeFactory, int file_descriptor);
private static native boolean nativeStartAecDump(
long nativeFactory, int file_descriptor, int filesize_limit_bytes);
private static native void nativeStopAecDump(long nativeFactory);

View File

@ -225,9 +225,10 @@ PeerConnectionFactory::CreateVideoSource(
return VideoSourceProxy::Create(signaling_thread_, source);
}
bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file) {
bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file,
int64_t max_size_bytes) {
RTC_DCHECK(signaling_thread_->IsCurrent());
return channel_manager_->StartAecDump(file);
return channel_manager_->StartAecDump(file, max_size_bytes);
}
void PeerConnectionFactory::StopAecDump() {

View File

@ -82,7 +82,7 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
CreateAudioTrack(const std::string& id,
AudioSourceInterface* audio_source) override;
bool StartAecDump(rtc::PlatformFile file) override;
bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) override;
void StopAecDump() override;
bool StartRtcEventLog(rtc::PlatformFile file) override;
void StopRtcEventLog() override;

View File

@ -62,7 +62,7 @@ BEGIN_PROXY_MAP(PeerConnectionFactory)
CreateVideoTrack, const std::string&, VideoSourceInterface*)
PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>,
CreateAudioTrack, const std::string&, AudioSourceInterface*)
PROXY_METHOD1(bool, StartAecDump, rtc::PlatformFile)
PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t)
PROXY_METHOD0(void, StopAecDump)
PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile)
PROXY_METHOD0(void, StopRtcEventLog)

View File

@ -578,9 +578,11 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
// Starts AEC dump using existing file. Takes ownership of |file| and passes
// it on to VoiceEngine (via other objects) immediately, which will take
// the ownerhip. If the operation fails, the file will be closed.
// TODO(grunell): Remove when Chromium has started to use AEC in each source.
// http://crbug.com/264611.
virtual bool StartAecDump(rtc::PlatformFile file) = 0;
// A maximum file size in bytes can be specified. When the file size limit is
// reached, logging is stopped automatically. If max_size_bytes is set to a
// value <= 0, no limit will be used, and logging will continue until the
// StopAecDump function is called.
virtual bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) = 0;
// Stops logging the AEC dump.
virtual void StopAecDump() = 0;