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

Side by Side Diff: content/browser/renderer_host/media/audio_debug_file_writer.h

Issue 2582703003: Audio output debug recording. (Closed)
Patch Set: Code review. Rebase. 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 unified diff | Download patch
OLDNEW
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 CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_DEBUG_FILE_WRITER_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_DEBUG_FILE_WRITER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_DEBUG_FILE_WRITER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_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/sequence_checker.h" 14 #include "base/sequence_checker.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "media/audio/audio_file_writer.h" 17 #include "media/audio/audio_file_writer.h"
18 #include "media/base/audio_parameters.h" 18 #include "media/base/audio_parameters.h"
19 19
20 namespace media { 20 namespace media {
21 21
22 class AudioBus; 22 class AudioBus;
23 23
24 } // namespace media 24 } // namespace media
25 25
26 namespace content { 26 namespace content {
27 27
28 // Writes audio input data used for debugging purposes. All operations are 28 // Writes audio data to a 16 bit PCM WAVE file used for debugging purposes. All
29 // non-blocking. 29 // operations are non-blocking.
30 class CONTENT_EXPORT AudioDebugFileWriter 30 class CONTENT_EXPORT AudioDebugFileWriter
31 : public NON_EXPORTED_BASE(media::AudioFileWriter) { 31 : public NON_EXPORTED_BASE(media::AudioFileWriter) {
32 public: 32 public:
33 explicit AudioDebugFileWriter(const media::AudioParameters& params); 33 explicit AudioDebugFileWriter(const media::AudioParameters& params);
34 ~AudioDebugFileWriter() override; 34 ~AudioDebugFileWriter() override;
35 35
36 // Number of channels and sample rate are used from |params|, the other
37 // parameters are ignored. The number of channels in the data passed to
38 // Write() must match |params|.
39 static std::unique_ptr<media::AudioFileWriter> Create(
40 const media::AudioParameters& params);
41
36 void Start(const base::FilePath& file) override; 42 void Start(const base::FilePath& file) override;
37 void Stop() override; 43 void Stop() override;
38 void Write(std::unique_ptr<media::AudioBus> data) override; 44 void Write(std::unique_ptr<media::AudioBus> data) override;
39 bool WillWrite() override; 45 bool WillWrite() override;
46 std::string GetExtension() override;
o1ka 2017/02/09 13:04:02 GetFileNameExtension() would be more descriptive.
Henrik Grunell 2017/02/10 09:00:56 Agree, changed.
40 47
41 private: 48 private:
42 class AudioFileWriter; 49 class AudioFileWriter;
43 using AudioFileWriterUniquePtr = 50 using AudioFileWriterUniquePtr =
44 std::unique_ptr<AudioFileWriter, BrowserThread::DeleteOnFileThread>; 51 std::unique_ptr<AudioFileWriter, BrowserThread::DeleteOnFileThread>;
45 AudioFileWriterUniquePtr file_writer_; 52 AudioFileWriterUniquePtr file_writer_;
46 const media::AudioParameters params_; 53 const media::AudioParameters params_;
47 base::SequenceChecker client_sequence_checker_; 54 base::SequenceChecker client_sequence_checker_;
48 }; 55 };
49 56
50 } // namspace content 57 } // namspace content
51 58
52 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_DEBUG_FILE_WRITER_H_ 59 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_DEBUG_FILE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698