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

Unified Diff: content/browser/media/audio_output_impl.h

Issue 1856673002: Mojofication of the Chrome Audio Rendering Prototype Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/media/audio_output_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/audio_output_impl.h
diff --git a/content/browser/media/audio_output_impl.h b/content/browser/media/audio_output_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..ec531729fe90dec55cdb31240b2c659dc71f5aa1
--- /dev/null
+++ b/content/browser/media/audio_output_impl.h
@@ -0,0 +1,92 @@
+// 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_MEDIA_AUDIO_OUTPUT_IMPL_H_
+#define CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/id_map.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "content/browser/renderer_host/media/audio_renderer_host.h"
+#include "content/common/content_export.h"
+#include "content/common/media/audio_output.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+
+namespace base {
+class FilePath;
+}
+
+namespace content {
+
+class AudioOutputStreamImpl : public mojom::AudioOutputStream {
+ public:
+ explicit AudioOutputStreamImpl(
+ mojo::InterfaceRequest<mojom::AudioOutputStream> request,
+ AudioEntry* entry,
+ int stream_id,
+ AudioRendererHost* audio_renderer_host);
+ void set(int a) override;
+ void Play(const PlayCallback& callback) override;
+ ~AudioOutputStreamImpl() override;
+
+ private:
+ int a_;
+ mojo::Binding<mojom::AudioOutputStream> binding_;
+ AudioEntry* entry_;
+ int stream_id_;
+ AudioRendererHost* audio_renderer_host_;
+ DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamImpl);
+};
+
+// This class must always be accessed from the creation thread.
+class CONTENT_EXPORT AudioOutputImpl
+ : NON_EXPORTED_BASE(public mojom::AudioOutput) {
+ public:
+ AudioOutputImpl(AudioRendererHost* audio_renderer_host,
+ mojom::AudioOutputRequest request);
+
+ ~AudioOutputImpl() override;
+
+ static void Create(scoped_refptr<AudioRendererHost> audio_renderer_host,
+ mojom::AudioOutputRequest request) {
+ new AudioOutputImpl(audio_renderer_host.get(), std::move(request));
+ }
+
+ int render_host_id() const { return render_host_id_; }
+ void InitMojo(mojo::InterfaceRequest<mojom::AudioOutput> request);
+
+ static mojom::AudioOutputStreamPtr* CreateStream(AudioEntry* entry,
+ int stream_id);
+
+ // static scoped_ptr<AudioOutputStreamImpl> stream_ptr;
+ private:
+ void CloseStream(int32_t id) override;
+ void CreateStream(int stream_id,
+ int render_frame_id,
+ mojom::AudioOutputStreamParametersPtr params,
+ const CreateStreamCallback& callback) override;
+ void DoCloseStream(int32_t id);
+
+ // Mojo connection error callback.
+ void OnDisconnect(AudioOutputImpl* impl);
+
+ // Render process host ID.
+ int render_host_id_;
+
+ static AudioRendererHost* audio_renderer_host_;
+
+ base::ThreadChecker thread_checker_;
+ mojo::Binding<AudioOutput> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioOutputImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/media/audio_output_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698