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

Unified Diff: content/browser/renderer_host/media/audio_output_stream_factory_context_impl.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/audio_output_stream_factory_context_impl.h
diff --git a/content/browser/renderer_host/media/audio_output_stream_factory_context_impl.h b/content/browser/renderer_host/media/audio_output_stream_factory_context_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..adb3131c4fef6bc16b1c8b5635913ed51a484a20
--- /dev/null
+++ b/content/browser/renderer_host/media/audio_output_stream_factory_context_impl.h
@@ -0,0 +1,73 @@
+// 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_AUDIO_OUTPUT_STREAM_FACTORY_CONTEXT_IMPL_H_
+#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_STREAM_FACTORY_CONTEXT_IMPL_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "content/browser/renderer_host/media/audio_output_stream_factory_context.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+
+namespace media {
+class AudioSystem;
+} // namespace media
+
+namespace content {
+
+class MediaStreamManager;
+
+// In addition to being an AudioOutputStreamFactoryContext, this class also
+// handles requests for mojom::RendererAudioOutputStreamFactory instances.
o1ka 2017/03/21 16:20:17 This sounds confusing, since "request" is also a M
Max Morin 2017/03/22 13:18:29 "request" means mojo request.
o1ka 2017/03/23 09:39:43 Ah, now I see it when you clarified the usage.
+class CONTENT_EXPORT AudioOutputStreamFactoryContextImpl
+ : public AudioOutputStreamFactoryContext {
+ public:
+ AudioOutputStreamFactoryContextImpl(int render_process_id,
+ media::AudioSystem* audio_system,
+ MediaStreamManager* media_stream_manager,
+ const std::string& salt);
+
+ ~AudioOutputStreamFactoryContextImpl() override;
+
+ void CreateFactory(
o1ka 2017/03/21 16:20:17 Could you add a comment on its usage?
Max Morin 2017/03/22 13:18:29 Done.
+ int frame_host_id,
+ mojo::InterfaceRequest<mojom::RendererAudioOutputStreamFactory> request);
+
+ // AudioOutputStreamFactoryContext impl:
o1ka 2017/03/21 16:20:17 implementation.
Max Morin 2017/03/22 13:18:29 Done.
+ int GetRenderProcessId() const override;
+
+ void RequestDeviceAuthorization(
+ int render_frame_id,
+ int session_id,
+ const std::string& device_id,
+ const url::Origin& security_origin,
+ AuthorizationCompletedCallback cb) const override;
+
+ const std::string& GetSalt() const override;
+
+ std::unique_ptr<media::AudioOutputDelegate> CreateDelegate(
+ const std::string& unique_device_id,
+ int render_frame_id,
+ const media::AudioParameters& params,
+ media::AudioOutputDelegate::EventHandler* handler) override;
+
+ void OnFactoryFinished(
+ mojom::RendererAudioOutputStreamFactory* factory) override;
+
+ private:
+ const int render_process_id_;
+ media::AudioSystem* const audio_system_;
+ MediaStreamManager* const media_stream_manager_;
+ const std::string salt_;
+ const AudioOutputAuthorizationHandler authorization_handler_;
+ int next_stream_id_ = 0;
+ std::vector<std::unique_ptr<mojom::RendererAudioOutputStreamFactory>>
+ factories_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_STREAM_FACTORY_CONTEXT_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698