Chromium Code Reviews| 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..438babd750902635a690e785b2f05157baa5f3a6 100644 |
| --- a/media/audio/audio_debug_file_writer.h |
| +++ b/media/audio/audio_debug_file_writer.h |
| @@ -21,32 +21,44 @@ 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. |
| 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(); |
|
o1ka
2017/03/01 18:36:23
It's inheritable for mocking only, right?
Having i
Henrik Grunell
2017/03/01 19:52:54
Yes. Added a comment.
|
| // 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 +80,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. |