Index: media/audio/audio_debug_file_writer.h |
diff --git a/media/audio/audio_debug_file_writer.h b/media/audio/audio_debug_file_writer.h |
index bb8b38ec12f0b4156b34a3e98ded247756b09b99..9d8a4c0f9b940e5076520c1a0d1ebf43a7916924 100644 |
--- a/media/audio/audio_debug_file_writer.h |
+++ b/media/audio/audio_debug_file_writer.h |
@@ -21,32 +21,45 @@ namespace media { |
class AudioBus; |
-// Writes audio data used for debugging purposes. All operations are |
-// non-blocking. |
+// Writes audio data to a 16 bit PCM WAVE file used for debugging purposes. All |
+// operations are non-blocking. |
+// Functions are virtual for the purpose of test mocking. |
class MEDIA_EXPORT AudioDebugFileWriter { |
public: |
+ // Number of channels and sample rate are used from |params|, the other |
+ // parameters are ignored. The number of channels in the data passed to |
+ // Write() must match |params|. |
AudioDebugFileWriter( |
const AudioParameters& params, |
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); |
- ~AudioDebugFileWriter(); |
+ |
+ virtual ~AudioDebugFileWriter(); |
// Must be called before calling Write() for the first time after creation or |
// Stop() call. Can be called on any sequence; Write() and Stop() must be |
// called on the same sequence as Start(). |
- void Start(const base::FilePath& file); |
+ virtual void Start(const base::FilePath& file); |
// Must be called to finish recording. Each call to Start() requires a call to |
// Stop(). Will be automatically called on destruction. |
- void Stop(); |
+ virtual void Stop(); |
// Write |data| to file. |
- void Write(std::unique_ptr<AudioBus> data); |
+ virtual void Write(std::unique_ptr<AudioBus> data); |
// Returns true if Write() call scheduled at this point will most likely write |
// data to the file, and false if it most likely will be a no-op. The result |
// may be ambigulous if Start() or Stop() is executed at the moment. Can be |
// called from any sequence. |
- bool WillWrite(); |
+ virtual bool WillWrite(); |
+ |
+ // Gets the extension for the file type the as a string, for example "wav". |
+ // Can be called before calling Start() to add the appropriate extension to |
+ // the filename. |
+ virtual const base::FilePath::CharType* GetFileNameExtension(); |
+ |
+ protected: |
+ const AudioParameters params_; |
private: |
class AudioFileWriter; |
@@ -68,7 +81,6 @@ class MEDIA_EXPORT AudioDebugFileWriter { |
std::unique_ptr<AudioFileWriter, OnThreadDeleter>; |
AudioFileWriterUniquePtr file_writer_; |
- const AudioParameters params_; |
base::SequenceChecker client_sequence_checker_; |
// The task runner to do file output operations on. |