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

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: Renamed and updated browser test. Rebase. Created 5 years, 4 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..b94761dd6e9c0b2fdd6dc94a686c462565cf7553 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,16 @@ 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);
+ // Enable and disable debug recording of input on all audio entries.
+ void EnableDebugRecording(const base::FilePath& file);
+ void DisableDebugRecording();
+
// BrowserMessageFilter implementation.
void OnChannelClosing() override;
void OnDestruct() const override;
@@ -122,6 +129,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 +221,26 @@ class CONTENT_EXPORT AudioInputRendererHost
void MaybeUnregisterKeyboardMicStream(
const AudioInputHostMsg_CreateStream_Config& config);
+ void MaybeEnableDebugRecordingForId(int stream_id);
+
+ base::FilePath GetDebugRecordingFilePathWithExtensions(
+ const base::FilePath& file);
+
+ void EnabledDebugRecordingForId(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);
+
// 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
+ // instabce.
tommi (sloooow) - chröme 2015/08/31 17:19:07 instance
Henrik Grunell 2015/09/04 12:37:37 Done.
+ int32 renderer_pid_;
tommi (sloooow) - chröme 2015/08/31 17:19:07 can this be const?
Henrik Grunell 2015/09/04 12:37:37 No, see void set_renderer_pid(int32 renderer_pid);
+
// Used to create an AudioInputController.
media::AudioManager* audio_manager_;
@@ -229,6 +257,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