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

Side by Side Diff: media/audio/audio_manager_base.h

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Reworked callbacks and interfaces. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_set> 10 #include <unordered_set>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "media/audio/audio_debug_recording_manager.h"
19 #include "media/audio/audio_device_name.h" 20 #include "media/audio/audio_device_name.h"
20 #include "media/audio/audio_manager.h" 21 #include "media/audio/audio_manager.h"
21 #include "media/audio/audio_output_dispatcher.h" 22 #include "media/audio/audio_output_dispatcher.h"
22 23
23 #if defined(OS_WIN) 24 #if defined(OS_WIN)
24 #include "base/win/scoped_com_initializer.h" 25 #include "base/win/scoped_com_initializer.h"
25 #endif 26 #endif
26 27
28 namespace base {
29 class FilePath;
30 }
31
27 namespace media { 32 namespace media {
28 33
29 class AudioOutputDispatcher; 34 class AudioOutputDispatcher;
30 35
31 // AudioManagerBase provides AudioManager functions common for all platforms. 36 // AudioManagerBase provides AudioManager functions common for all platforms.
32 class MEDIA_EXPORT AudioManagerBase : public AudioManager { 37 class MEDIA_EXPORT AudioManagerBase : public AudioManager {
33 public: 38 public:
34 ~AudioManagerBase() override; 39 ~AudioManagerBase() override;
35 40
36 // AudioManager: 41 // AudioManager:
(...skipping 23 matching lines...) Expand all
60 65
61 AudioParameters GetDefaultOutputStreamParameters() override; 66 AudioParameters GetDefaultOutputStreamParameters() override;
62 AudioParameters GetOutputStreamParameters( 67 AudioParameters GetOutputStreamParameters(
63 const std::string& device_id) override; 68 const std::string& device_id) override;
64 AudioParameters GetInputStreamParameters( 69 AudioParameters GetInputStreamParameters(
65 const std::string& device_id) override; 70 const std::string& device_id) override;
66 std::string GetAssociatedOutputDeviceID( 71 std::string GetAssociatedOutputDeviceID(
67 const std::string& input_device_id) override; 72 const std::string& input_device_id) override;
68 std::unique_ptr<AudioLog> CreateAudioLog( 73 std::unique_ptr<AudioLog> CreateAudioLog(
69 AudioLogFactory::AudioComponent component) override; 74 AudioLogFactory::AudioComponent component) override;
75 void EnableOutputDebugRecording(
76 const base::FilePath& base_file_name) override;
77 void DisableOutputDebugRecording() override;
70 78
71 void SetMaxStreamCountForTesting(int max_input, int max_output) final; 79 void SetMaxStreamCountForTesting(int max_input, int max_output) final;
72 80
73 // AudioManagerBase: 81 // AudioManagerBase:
74 82
75 // Called internally by the audio stream when it has been closed. 83 // Called internally by the audio stream when it has been closed.
76 virtual void ReleaseOutputStream(AudioOutputStream* stream); 84 virtual void ReleaseOutputStream(AudioOutputStream* stream);
77 virtual void ReleaseInputStream(AudioInputStream* stream); 85 virtual void ReleaseInputStream(AudioInputStream* stream);
78 86
79 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy 87 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy
(...skipping 24 matching lines...) Expand all
104 // Get number of input or output streams. 112 // Get number of input or output streams.
105 int input_stream_count() const { 113 int input_stream_count() const {
106 return static_cast<int>(input_streams_.size()); 114 return static_cast<int>(input_streams_.size());
107 } 115 }
108 int output_stream_count() const { return num_output_streams_; } 116 int output_stream_count() const { return num_output_streams_; }
109 117
110 protected: 118 protected:
111 AudioManagerBase( 119 AudioManagerBase(
112 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 120 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
113 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 121 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
114 AudioLogFactory* audio_log_factory); 122 AudioLogFactory* audio_log_factory,
123 CreateAudioFileWriterCallback create_audio_file_writer_callback);
115 124
116 // Releases all the audio output dispatchers. 125 // Releases all the audio output dispatchers.
117 // All audio streams should be closed before Shutdown() is called. 126 // All audio streams should be closed before Shutdown() is called.
118 // This must be called in the destructor of every AudioManagerBase 127 // This must be called in the destructor of every AudioManagerBase
119 // implementation. 128 // implementation.
120 void Shutdown(); 129 void Shutdown();
121 130
122 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } 131 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; }
123 132
124 // Called by each platform specific AudioManager to notify output state change 133 // Called by each platform specific AudioManager to notify output state change
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // Contains currently open input streams. 191 // Contains currently open input streams.
183 std::unordered_set<AudioInputStream*> input_streams_; 192 std::unordered_set<AudioInputStream*> input_streams_;
184 193
185 // Map of cached AudioOutputDispatcher instances. Must only be touched 194 // Map of cached AudioOutputDispatcher instances. Must only be touched
186 // from the audio thread (no locking). 195 // from the audio thread (no locking).
187 AudioOutputDispatchers output_dispatchers_; 196 AudioOutputDispatchers output_dispatchers_;
188 197
189 // Proxy for creating AudioLog objects. 198 // Proxy for creating AudioLog objects.
190 AudioLogFactory* const audio_log_factory_; 199 AudioLogFactory* const audio_log_factory_;
191 200
201 AudioDebugRecordingManager output_debug_recording_manager_;
202
192 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); 203 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
193 }; 204 };
194 205
195 } // namespace media 206 } // namespace media
196 207
197 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 208 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698