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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/audio_input_debug_writer.h
diff --git a/content/browser/renderer_host/media/audio_input_debug_writer.h b/content/browser/renderer_host/media/audio_input_debug_writer.h
new file mode 100644
index 0000000000000000000000000000000000000000..683321105948ad576a4b2c171f7b2be4d2c7dd2b
--- /dev/null
+++ b/content/browser/renderer_host/media/audio_input_debug_writer.h
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
+
+#include "base/files/file.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/move.h"
+#include "media/audio/audio_input_writer.h"
+
+namespace media {
+
+class AudioBus;
+class AudioBusRefCounted;
+
+} // namespace media
+
+namespace content {
+
+// Writes audio input data used for debugging purposes. Can be created on any
+// thread. Must be destroyed on the FILE thread. Write call can be made on any
+// thread. This object must be unregistered in Write caller before destroyed.
+// When created, it takes ownership of |file|.
+class AudioInputDebugWriter : public media::AudioInputWriter {
+ public:
+ explicit AudioInputDebugWriter(base::File file);
+
+ ~AudioInputDebugWriter() override;
+
+ // Write data from |data| to file.
+ void Write(scoped_ptr<media::AudioBus> data) override;
+
+ private:
+ // Write data from |data| to file. Called on the FILE thread.
+ void DoWrite(scoped_ptr<media::AudioBus> data);
+
+ // The file to write to.
+ base::File file_;
+
+ // Intermediate buffer to be written to file. Interleaved 16 bit audio data.
+ scoped_ptr<int16[]> interleaved_data_;
+ int interleaved_data_size_;
+
+ base::WeakPtrFactory<AudioInputDebugWriter> weak_factory_;
+};
+
+} // namspace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEBUG_WRITER_H_
« 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