| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_DEBUG_RECORDING_MANAGER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_DEBUG_RECORDING_MANAGER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_DEBUG_RECORDING_MANAGER_H_ | 6 #define MEDIA_AUDIO_AUDIO_DEBUG_RECORDING_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // AudioManager::InitializeOutputDebugRecording() is called. That is done | 54 // AudioManager::InitializeOutputDebugRecording() is called. That is done |
| 55 // in AudioManager::Create() in WebRTC enabled builds, but not in non WebRTC | 55 // in AudioManager::Create() in WebRTC enabled builds, but not in non WebRTC |
| 56 // enabled builds. | 56 // enabled builds. |
| 57 // If AudioDebugRecordingManager is not created, neither is | 57 // If AudioDebugRecordingManager is not created, neither is |
| 58 // AudioDebugRecordingHelper or AudioDebugFileWriter. In this case the pointers | 58 // AudioDebugRecordingHelper or AudioDebugFileWriter. In this case the pointers |
| 59 // to AudioDebugRecordingManager and AudioDebugRecordingHelper are null. | 59 // to AudioDebugRecordingManager and AudioDebugRecordingHelper are null. |
| 60 // | 60 // |
| 61 class MEDIA_EXPORT AudioDebugRecordingManager { | 61 class MEDIA_EXPORT AudioDebugRecordingManager { |
| 62 public: | 62 public: |
| 63 AudioDebugRecordingManager( | 63 AudioDebugRecordingManager( |
| 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 65 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); | |
| 66 virtual ~AudioDebugRecordingManager(); | 65 virtual ~AudioDebugRecordingManager(); |
| 67 | 66 |
| 68 // Enables and disables debug recording. | 67 // Enables and disables debug recording. |
| 69 virtual void EnableDebugRecording(const base::FilePath& base_file_name); | 68 virtual void EnableDebugRecording(const base::FilePath& base_file_name); |
| 70 virtual void DisableDebugRecording(); | 69 virtual void DisableDebugRecording(); |
| 71 | 70 |
| 72 // Registers a source and returns a wrapped recorder. |file_name_extension| is | 71 // Registers a source and returns a wrapped recorder. |file_name_extension| is |
| 73 // added to the base filename, along with a unique running ID. | 72 // added to the base filename, along with a unique running ID. |
| 74 std::unique_ptr<AudioDebugRecorder> RegisterDebugRecordingSource( | 73 std::unique_ptr<AudioDebugRecorder> RegisterDebugRecordingSource( |
| 75 const base::FilePath::StringType& file_name_extension, | 74 const base::FilePath::StringType& file_name_extension, |
| 76 const AudioParameters& params); | 75 const AudioParameters& params); |
| 77 | 76 |
| 78 protected: | 77 protected: |
| 79 // Creates a AudioDebugRecordingHelper. Overridden by test. | 78 // Creates a AudioDebugRecordingHelper. Overridden by test. |
| 80 virtual std::unique_ptr<AudioDebugRecordingHelper> | 79 virtual std::unique_ptr<AudioDebugRecordingHelper> |
| 81 CreateAudioDebugRecordingHelper( | 80 CreateAudioDebugRecordingHelper( |
| 82 const AudioParameters& params, | 81 const AudioParameters& params, |
| 83 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 82 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 84 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | |
| 85 base::OnceClosure on_destruction_closure); | 83 base::OnceClosure on_destruction_closure); |
| 86 | 84 |
| 87 // The task runner this class lives on. Also handed to | 85 // The task runner this class lives on. Also handed to |
| 88 // AudioDebugRecordingHelpers. | 86 // AudioDebugRecordingHelpers. |
| 89 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 87 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 90 | 88 |
| 91 private: | 89 private: |
| 92 FRIEND_TEST_ALL_PREFIXES(AudioDebugRecordingManagerTest, | 90 FRIEND_TEST_ALL_PREFIXES(AudioDebugRecordingManagerTest, |
| 93 RegisterAutomaticUnregisterAtDelete); | 91 RegisterAutomaticUnregisterAtDelete); |
| 94 FRIEND_TEST_ALL_PREFIXES(AudioDebugRecordingManagerTest, | 92 FRIEND_TEST_ALL_PREFIXES(AudioDebugRecordingManagerTest, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 106 | 104 |
| 107 bool IsDebugRecordingEnabled(); | 105 bool IsDebugRecordingEnabled(); |
| 108 | 106 |
| 109 // Recorders, one per source. | 107 // Recorders, one per source. |
| 110 DebugRecordingHelperMap debug_recording_helpers_; | 108 DebugRecordingHelperMap debug_recording_helpers_; |
| 111 | 109 |
| 112 // The base file name for debug recording files. If this is non-empty, debug | 110 // The base file name for debug recording files. If this is non-empty, debug |
| 113 // recording is enabled. | 111 // recording is enabled. |
| 114 base::FilePath debug_recording_base_file_name_; | 112 base::FilePath debug_recording_base_file_name_; |
| 115 | 113 |
| 116 // Task runner that the file writer does file output operations on. Handed to | |
| 117 // AudioDebugRecordingHelpers | |
| 118 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | |
| 119 | |
| 120 base::WeakPtrFactory<AudioDebugRecordingManager> weak_factory_; | 114 base::WeakPtrFactory<AudioDebugRecordingManager> weak_factory_; |
| 121 DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingManager); | 115 DISALLOW_COPY_AND_ASSIGN(AudioDebugRecordingManager); |
| 122 }; | 116 }; |
| 123 | 117 |
| 124 } // namespace media | 118 } // namespace media |
| 125 | 119 |
| 126 #endif // MEDIA_AUDIO_AUDIO_DEBUG_RECORDING_MANAGER_H_ | 120 #endif // MEDIA_AUDIO_AUDIO_DEBUG_RECORDING_MANAGER_H_ |
| OLD | NEW |