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

Unified Diff: media/audio/audio_manager_base.h

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Using callbacks instead. Created 3 years, 11 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: media/audio/audio_manager_base.h
diff --git a/media/audio/audio_manager_base.h b/media/audio/audio_manager_base.h
index b3100cf6c507bb6cb6af2086806356cc3c6de15a..7c1850187f1ee85a9bd26e8a03211ad44ffab5e6 100644
--- a/media/audio/audio_manager_base.h
+++ b/media/audio/audio_manager_base.h
@@ -5,12 +5,14 @@
#ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
#define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
+#include <map>
#include <memory>
#include <string>
#include <unordered_set>
#include <utility>
#include "base/compiler_specific.h"
+#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/scoped_vector.h"
#include "base/observer_list.h"
@@ -26,7 +28,9 @@
namespace media {
+class AudioDebugRecordingHelper;
class AudioOutputDispatcher;
+class AudioOutputResampler;
// AudioManagerBase provides AudioManager functions common for all platforms.
class MEDIA_EXPORT AudioManagerBase : public AudioManager {
@@ -67,6 +71,9 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
const std::string& input_device_id) override;
std::unique_ptr<AudioLog> CreateAudioLog(
AudioLogFactory::AudioComponent component) override;
+ void EnableOutputDebugRecording(
+ const base::FilePath& base_file_name) override;
+ void DisableOutputDebugRecording() override;
void SetMaxStreamCountForTesting(int max_input, int max_output) final;
@@ -111,7 +118,8 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
AudioManagerBase(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
- AudioLogFactory* audio_log_factory);
+ AudioLogFactory* audio_log_factory,
+ CreateAudioFileWriterCallback create_audio_file_writer_callback);
// Releases all the audio output dispatchers.
// All audio streams should be closed before Shutdown() is called.
@@ -159,6 +167,9 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
class CompareByParams;
+ using DebugRecordingHelperMap =
+ std::map<int, std::unique_ptr<AudioDebugRecordingHelper>>;
+
// These functions assign group ids to devices based on their device ids.
// The default implementation is an attempt to do this based on
// GetAssociatedOutputDeviceID. Must be called on the audio worker thread
@@ -166,6 +177,12 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
std::string GetGroupIDOutput(const std::string& output_device_id);
std::string GetGroupIDInput(const std::string& input_device_id);
+ // Handles debug recording. Passed to AudioOutputResampler as callbacks. See
+ // description of callback definitions in AudioOutputResampler.
+ void RegisterDebugRecordingSource(int id, const AudioParameters& params);
+ void UnregisterDebugRecordingSource(int id);
+ void OnDebugRecordingData(int id, AudioBus* data);
+
// Max number of open output streams, modified by
// SetMaxOutputStreamsAllowed().
int max_num_output_streams_;
@@ -189,6 +206,16 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
// Proxy for creating AudioLog objects.
AudioLogFactory* const audio_log_factory_;
+ // Callback for creating AudioFileWriter objects.
+ CreateAudioFileWriterCallback create_audio_file_writer_callback_;
+
+ // The base file name for debug recording files. If this is non-empty, debug
+ // recording is enabled.
+ base::FilePath debug_recording_base_file_name_;
+
+ // DebugRecordingHelpers, one per stream.
+ DebugRecordingHelperMap debug_recording_helpers_;
+
DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
};

Powered by Google App Engine
This is Rietveld 408576698