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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
8 #include "base/files/file.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/move.h"
14 #include "media/audio/audio_input_writer.h"
19 class AudioBusRefCounted
;
25 // Writes audio input data used for debugging purposes. Can be created on any
26 // thread. Must be destroyed on the FILE thread. Write call can be made on any
27 // thread. This object must be unregistered in Write caller before destroyed.
28 // When created, it takes ownership of |file|.
29 class AudioInputDebugWriter
: public media::AudioInputWriter
{
31 explicit AudioInputDebugWriter(base::File file
);
33 ~AudioInputDebugWriter() override
;
35 // Write data from |data| to file.
36 void Write(scoped_ptr
<media::AudioBus
> data
) override
;
39 // Write data from |data| to file. Called on the FILE thread.
40 void DoWrite(scoped_ptr
<media::AudioBus
> data
);
42 // The file to write to.
45 // Intermediate buffer to be written to file. Interleaved 16 bit audio data.
46 scoped_ptr
<int16
[]> interleaved_data_
;
47 int interleaved_data_size_
;
49 base::WeakPtrFactory
<AudioInputDebugWriter
> weak_factory_
;
54 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_