Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_FILE_WRITER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ | 6 #define MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/sequence_checker.h" | 15 #include "base/sequence_checker.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
|
gab
2017/05/18 20:38:17
Fix include
Sébastien Marchand
2017/05/18 21:24:25
Done.
| |
| 17 #include "media/base/audio_parameters.h" | 17 #include "media/base/audio_parameters.h" |
| 18 #include "media/base/media_export.h" | 18 #include "media/base/media_export.h" |
| 19 | 19 |
| 20 namespace media { | 20 namespace media { |
| 21 | 21 |
| 22 class AudioBus; | 22 class AudioBus; |
| 23 | 23 |
| 24 // Writes audio data to a 16 bit PCM WAVE file used for debugging purposes. All | 24 // Writes audio data to a 16 bit PCM WAVE file used for debugging purposes. All |
| 25 // operations are non-blocking. | 25 // operations are non-blocking. |
| 26 // Functions are virtual for the purpose of test mocking. | 26 // Functions are virtual for the purpose of test mocking. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 // the filename. | 58 // the filename. |
| 59 virtual const base::FilePath::CharType* GetFileNameExtension(); | 59 virtual const base::FilePath::CharType* GetFileNameExtension(); |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 const AudioParameters params_; | 62 const AudioParameters params_; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 class AudioFileWriter; | 65 class AudioFileWriter; |
| 66 | 66 |
| 67 // Deleter for AudioFileWriter. | 67 // Deleter for AudioFileWriter. |
| 68 struct OnThreadDeleter { | 68 struct OnSequenceDeleter { |
| 69 public: | 69 public: |
| 70 OnThreadDeleter(); | 70 OnSequenceDeleter(); |
| 71 OnThreadDeleter(const OnThreadDeleter& other); | 71 OnSequenceDeleter(const OnSequenceDeleter& other); |
|
gab
2017/05/18 20:38:17
I'm pretty sure this is only needed to pass it by
Sébastien Marchand
2017/05/18 21:24:25
Done, I also had to provide the OnSequenceDeleter&
| |
| 72 OnThreadDeleter(scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 72 OnSequenceDeleter(scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 73 ~OnThreadDeleter(); | 73 ~OnSequenceDeleter(); |
| 74 void operator()(AudioFileWriter* ptr) const; | 74 void operator()(AudioFileWriter* ptr) const; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 77 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 using AudioFileWriterUniquePtr = | 80 using AudioFileWriterUniquePtr = |
| 81 std::unique_ptr<AudioFileWriter, OnThreadDeleter>; | 81 std::unique_ptr<AudioFileWriter, OnSequenceDeleter>; |
| 82 | 82 |
| 83 AudioFileWriterUniquePtr file_writer_; | 83 AudioFileWriterUniquePtr file_writer_; |
| 84 base::SequenceChecker client_sequence_checker_; | 84 base::SequenceChecker client_sequence_checker_; |
| 85 | 85 |
| 86 // The task runner to do file output operations on. | 86 // The task runner to do file output operations on. |
| 87 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 87 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(AudioDebugFileWriter); | 89 DISALLOW_COPY_AND_ASSIGN(AudioDebugFileWriter); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namspace media | 92 } // namspace media |
| 93 | 93 |
| 94 #endif // MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ | 94 #endif // MEDIA_AUDIO_AUDIO_DEBUG_FILE_WRITER_H_ |
| OLD | NEW |