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

Unified Diff: media/audio/audio_debug_file_writer.h

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Code review. Created 3 years, 10 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
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/audio_debug_file_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/audio_debug_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698