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

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

Issue 2697663003: Add mojo interface+impl creation of audio streams. (Closed)
Patch Set: Created 3 years, 9 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/render_frame_audio_output_stream_factory.h
diff --git a/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h b/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..bdfcf2034f87bc83d2bf21f7ae3b51cc570c2256
--- /dev/null
+++ b/content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h
@@ -0,0 +1,66 @@
+// Copyright 2017 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_RENDER_FRAME_AUDIO_OUTPUT_STREAM_FACTORY_H_
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDER_FRAME_AUDIO_OUTPUT_STREAM_FACTORY_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "content/common/content_export.h"
+#include "content/common/media/renderer_audio_output_stream_factory.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace content {
+
+class RendererAudioOutputStreamFactoryContext;
+
+// Handles a RendererAudioOutputStreamFactory request for a render frame host,
+// using the provided RendererAudioOutputStreamFactoryContext.
+class CONTENT_EXPORT RenderFrameAudioOutputStreamFactory
+ : public mojom::RendererAudioOutputStreamFactory {
+ public:
+ RenderFrameAudioOutputStreamFactory(
+ RendererAudioOutputStreamFactoryContext* context,
+ int render_frame_id);
+
+ ~RenderFrameAudioOutputStreamFactory() override;
+
+ private:
+ using OutputStreamProviderVector =
+ std::vector<std::unique_ptr<media::mojom::AudioOutputStreamProvider>>;
+
+ // mojom::RendererAudioOutputStreamFactory implementation.
+ void RequestDeviceAuthorization(
+ media::mojom::AudioOutputStreamProviderRequest stream_provider,
+ int64_t session_id,
+ const std::string& device_id,
+ const url::Origin& origin,
+ const RequestDeviceAuthorizationCallback& callback) override;
+
+ void AuthorizationCompleted(
+ const url::Origin& origin,
+ base::TimeTicks auth_start_time,
+ media::mojom::AudioOutputStreamProviderRequest request,
+ const RequestDeviceAuthorizationCallback& callback,
+ media::OutputDeviceStatus status,
+ bool should_send_id,
+ const media::AudioParameters& params,
+ const std::string& raw_device_id);
+
+ void RemoveStream(media::mojom::AudioOutputStreamProvider* stream_provider);
+
+ base::ThreadChecker thread_checker_;
+ RendererAudioOutputStreamFactoryContext* const context_;
+ // The stream providers will contain the corresponding streams.
+ OutputStreamProviderVector stream_providers_;
+ const int render_frame_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderFrameAudioOutputStreamFactory);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDER_FRAME_AUDIO_OUTPUT_STREAM_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698