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

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

Issue 1272223003: Implement writing mic audio input data to file for debugging purposes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 3 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
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
7
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"
15
16 namespace media {
17
18 class AudioBus;
19 class AudioBusRefCounted;
20
21 } // namespace media
22
23 namespace content {
24
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 {
30 public:
31 explicit AudioInputDebugWriter(base::File file);
32
33 ~AudioInputDebugWriter() override;
34
35 // Write data from |data| to file.
36 void Write(scoped_ptr<media::AudioBus> data) override;
37
38 private:
39 // Write data from |data| to file. Called on the FILE thread.
40 void DoWrite(scoped_ptr<media::AudioBus> data);
41
42 // The file to write to.
43 base::File file_;
44
45 // Intermediate buffer to be written to file. Interleaved 16 bit audio data.
46 scoped_ptr<int16[]> interleaved_data_;
47 int interleaved_data_size_;
48
49 base::WeakPtrFactory<AudioInputDebugWriter> weak_factory_;
50 };
51
52 } // namspace content
53
54 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_internals_unittest.cc ('k') | content/browser/renderer_host/media/audio_input_debug_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698