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

Unified Diff: content/renderer/media/webrtc_audio_device_impl.h

Issue 334743006: Support multiple files for AEC dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review (sky). Created 6 years, 6 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: content/renderer/media/webrtc_audio_device_impl.h
diff --git a/content/renderer/media/webrtc_audio_device_impl.h b/content/renderer/media/webrtc_audio_device_impl.h
index d182acfe04c2d9b4e693b38b9992a8d153c362f0..042ecac9e8b18160de1ccf60705b9a19e72a280f 100644
--- a/content/renderer/media/webrtc_audio_device_impl.h
+++ b/content/renderer/media/webrtc_audio_device_impl.h
@@ -16,6 +16,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "content/common/content_export.h"
+#include "content/renderer/media/aec_dump_message_filter.h"
#include "content/renderer/media/webrtc_audio_capturer.h"
#include "content/renderer/media/webrtc_audio_device_not_impl.h"
#include "ipc/ipc_platform_file.h"
@@ -271,7 +272,8 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
: NON_EXPORTED_BASE(public PeerConnectionAudioSink),
NON_EXPORTED_BASE(public WebRtcAudioDeviceNotImpl),
NON_EXPORTED_BASE(public WebRtcAudioRendererSource),
- NON_EXPORTED_BASE(public WebRtcPlayoutDataSource) {
+ NON_EXPORTED_BASE(public WebRtcPlayoutDataSource),
+ NON_EXPORTED_BASE(public AecDumpMessageFilter::AecDumpObserver) {
public:
// The maximum volume value WebRtc uses.
static const int kMaxVolumeLevel = 255;
@@ -325,6 +327,13 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
virtual int32_t RecordingSampleRate(uint32_t* sample_rate) const OVERRIDE;
virtual int32_t PlayoutSampleRate(uint32_t* sample_rate) const OVERRIDE;
+ // AecDumpMessageFilter::AecDumpObserver implementation.
+ virtual void OnAecDumpFile(
+ int id,
+ const IPC::PlatformFileForTransit& file_handle) OVERRIDE;
+ virtual void OnDisableAecDump() OVERRIDE;
+ virtual void OnIpcClosed() OVERRIDE;
+
// Sets the |renderer_|, returns false if |renderer_| already exists.
// Called on the main renderer thread.
bool SetAudioRenderer(WebRtcAudioRenderer* renderer);
@@ -353,17 +362,8 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
return renderer_;
}
- // Enables the Aec dump. If the default capturer exists, it will call
- // StartAecDump() on the capturer and pass the ownership of the file to
- // WebRtc. Otherwise it will hold the file until a capturer is added.
- void EnableAecDump(base::File aec_dump_file);
-
- // Disables the Aec dump. When this method is called, the ongoing Aec dump
- // on WebRtc will be stopped.
- void DisableAecDump();
-
private:
- typedef std::list<scoped_refptr<WebRtcAudioCapturer> > CapturerList;
+ typedef std::map<int, scoped_refptr<WebRtcAudioCapturer> > CapturerMap;
typedef std::list<WebRtcPlayoutDataSource::Sink*> PlayoutDataSinkList;
class RenderBuffer;
@@ -401,17 +401,20 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
virtual void AddPlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE;
virtual void RemovePlayoutSink(WebRtcPlayoutDataSource::Sink* sink) OVERRIDE;
- // Helper to start the Aec dump if the default capturer exists.
- void MaybeStartAecDump();
+ // Registers capturer with ID |id| as an AEC dump consumer with the browser.
+ void RegisterAecDumpForId(int id);
+
+ // Disables the AEC dump on all capturers.
+ void DisableAecDump();
// Used to DCHECK that we are called on the correct thread.
base::ThreadChecker thread_checker_;
int ref_count_;
- // List of captures which provides access to the native audio input layer
+ // Map of captures which provides access to the native audio input layer
// in the browser process.
- CapturerList capturers_;
+ CapturerMap capturers_;
// Provides access to the audio renderer in the browser process.
scoped_refptr<WebRtcAudioRenderer> renderer_;
@@ -452,8 +455,11 @@ class CONTENT_EXPORT WebRtcAudioDeviceImpl
// It is only accessed by the audio render thread.
std::vector<int16> render_buffer_;
- // Used for start the Aec dump on the default capturer.
- base::File aec_dump_file_;
+ // Communication with browser for AEC dump.
+ // This is only used if audio track processing is enabled.
+ // TODO(xians): Remove the above comment line when option to disable audio
+ // track processing is removed.
+ scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_;
// Flag to tell if audio processing is enabled in MediaStreamAudioProcessor.
const bool is_audio_track_processing_enabled_;

Powered by Google App Engine
This is Rietveld 408576698