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

Unified Diff: content/browser/renderer_host/media/audio_input_renderer_host.h

Issue 1272223003: Implement writing mic audio input data to file for debugging purposes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 3 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/browser/renderer_host/media/audio_input_renderer_host.h
diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.h b/content/browser/renderer_host/media/audio_input_renderer_host.h
index eca0a6499be6500d51175484825cb041dcc6cda8..64e8fa611150a7ed073278c79ccd703b5c6adb95 100644
--- a/content/browser/renderer_host/media/audio_input_renderer_host.h
+++ b/content/browser/renderer_host/media/audio_input_renderer_host.h
@@ -32,6 +32,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
+#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "base/sequenced_task_runner_helpers.h"
#include "content/common/media/audio_messages.h"
@@ -51,6 +52,7 @@ class UserInputMonitor;
namespace content {
class AudioMirroringManager;
class MediaStreamManager;
+class RenderProcessHost;
class CONTENT_EXPORT AudioInputRendererHost
: public BrowserMessageFilter,
@@ -102,11 +104,18 @@ class CONTENT_EXPORT AudioInputRendererHost
// Called from UI thread from the owner of this object.
// |user_input_monitor| is used for typing detection and can be NULL.
AudioInputRendererHost(int render_process_id,
+ int32 renderer_pid,
media::AudioManager* audio_manager,
MediaStreamManager* media_stream_manager,
AudioMirroringManager* audio_mirroring_manager,
media::UserInputMonitor* user_input_monitor);
+#if defined(ENABLE_WEBRTC)
+ // Enable and disable debug recording of input on all audio entries.
+ void EnableDebugRecording(const base::FilePath& file);
+ void DisableDebugRecording();
+#endif
+
// BrowserMessageFilter implementation.
void OnChannelClosing() override;
void OnDestruct() const override;
@@ -122,6 +131,10 @@ class CONTENT_EXPORT AudioInputRendererHost
void OnLog(media::AudioInputController* controller,
const std::string& message) override;
+ // Sets the PID renderer. This is used for constructing the debug recording
+ // filename.
+ void set_renderer_pid(int32 renderer_pid);
+
private:
// TODO(henrika): extend test suite (compare AudioRenderHost)
friend class BrowserThread;
@@ -210,9 +223,28 @@ class CONTENT_EXPORT AudioInputRendererHost
void MaybeUnregisterKeyboardMicStream(
const AudioInputHostMsg_CreateStream_Config& config);
+#if defined(ENABLE_WEBRTC)
+ void MaybeEnableDebugRecordingForId(int stream_id);
+
+ base::FilePath GetDebugRecordingFilePathWithExtensions(
+ const base::FilePath& file);
+
+ void EnableDebugRecordingForId(const base::FilePath& file, int stream_id);
+
+ void DoEnableDebugRecording(int stream_id, base::File file);
+ void DoDisableDebugRecording(int stream_id);
+
+ // Delete the debug writer used for debug recordings for |stream_id|.
+ void DeleteDebugWriter(int stream_id);
+#endif
+
// ID of the RenderProcessHost that owns this instance.
const int render_process_id_;
+ // PID of the render process connected to the RenderProcessHost that owns this
+ // instance.
+ int32 renderer_pid_;
+
// Used to create an AudioInputController.
media::AudioManager* audio_manager_;
@@ -229,6 +261,8 @@ class CONTENT_EXPORT AudioInputRendererHost
scoped_ptr<media::AudioLog> audio_log_;
+ base::WeakPtrFactory<AudioInputRendererHost> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(AudioInputRendererHost);
};

Powered by Google App Engine
This is Rietveld 408576698