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

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

Issue 2319493002: Add mojo interface for audio rendering. (Closed)
Patch Set: Refactor factory. Created 3 years, 11 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_output_impl.h
diff --git a/content/browser/renderer_host/media/audio_output_impl.h b/content/browser/renderer_host/media/audio_output_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..152c64e01f00fc21ffb6a6310f9338d46eefff1b
--- /dev/null
+++ b/content/browser/renderer_host/media/audio_output_impl.h
@@ -0,0 +1,66 @@
+// Copyright 2016 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_OUTPUT_IMPL_H_
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_IMPL_H_
+
+#include <memory>
+#include <string>
+
+#include "base/single_thread_task_runner.h"
+#include "content/browser/renderer_host/media/audio_output_delegate.h"
+#include "content/common/content_export.h"
+#include "media/mojo/interfaces/audio_output.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace content {
+
+class CONTENT_EXPORT AudioOutputImpl
+ : public media::mojom::AudioOutput,
+ public AudioOutputDelegate::EventHandler {
o1ka 2017/01/25 15:15:21 Can we use aggregation instead of inheritance (whe
+ public:
+ using DelegateFactoryCallback =
o1ka 2017/01/25 15:15:21 CreateAudioOutputDelegateCallback maybe? Oe Create
+ base::OnceCallback<AudioOutputDelegate::UniquePtr(
+ AudioOutputDelegate::EventHandler*,
+ const media::AudioParameters&)>;
+
+ using FinishedCallback = base::OnceCallback<void(AudioOutputImpl*)>;
o1ka 2017/01/25 15:15:21 What this name stands for?
+
+ AudioOutputImpl(media::mojom::AudioOutputRequest request,
+ FinishedCallback finished_callback,
+ DelegateFactoryCallback delegate_factory_callback);
+
+ ~AudioOutputImpl() override;
+
+ // media::mojom::AudioOutput implementation.
+ // May only be called via mojo, not directly.
o1ka 2017/01/25 15:15:21 What does it mean?
+ void Start(const media::AudioParameters& params,
+ const StartCallback& callback) override;
+ void Play() override;
+ void Pause() override;
+ void SetVolume(double volume) override;
+
+ // AudioOutputDelegate::EventHandler implementation.
+ void OnStreamStateChanged(bool playing) override;
+ void OnStreamCreated(int stream_id,
+ base::SharedMemory* shared_memory,
+ base::CancelableSyncSocket* foreign_socket) override;
+ void OnStreamError(int stream_id) override;
+
+ private:
+ // Closes connection to client and notifies owner.
+ void OnError();
+
+ StartCallback start_callback_;
+ DelegateFactoryCallback delegate_factory_callback_;
+ FinishedCallback finished_callback_;
+ mojo::Binding<AudioOutput> binding_;
+ AudioOutputDelegate::UniquePtr delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioOutputImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698