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

Side by Side Diff: content/browser/renderer_host/media/renderer_audio_output_stream_factory_context_impl.h

Issue 2788173002: Revert of Add mojo interface+impl creation of audio streams. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDERER_AUDIO_OUTPUT_STREAM_FACTORY _CONTEXT_IMPL_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDERER_AUDIO_OUTPUT_STREAM_FACTORY _CONTEXT_IMPL_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "content/browser/renderer_host/media/renderer_audio_output_stream_facto ry_context.h"
12 #include "content/common/media/renderer_audio_output_stream_factory.mojom.h"
13 #include "mojo/public/cpp/bindings/interface_request.h"
14 #include "mojo/public/cpp/bindings/strong_binding_set.h"
15
16 namespace media {
17 class AudioManager;
18 class AudioSystem;
19 } // namespace media
20
21 namespace content {
22
23 class MediaStreamManager;
24
25 // In addition to being a RendererAudioOutputStreamFactoryContext, this class
26 // also handles requests for mojom::RendererAudioOutputStreamFactory instances.
27 //
28 // Ownership diagram for stream IPC classes (excluding interfaces):
29 // RendererAudioOutputStreamFactoryContext
30 // ^
31 // | owns (at most one per render frame in the process).
32 // |
33 // RenderFrameAudioOutputStreamFactory
34 // ^
35 // | owns (one per stream for the frame).
36 // |
37 // media::MojoAudioOutputStreamProvider
38 // ^
39 // | owns (one).
40 // |
41 // media::MojoAudioOutputStream
42
43 class CONTENT_EXPORT RendererAudioOutputStreamFactoryContextImpl
44 : public RendererAudioOutputStreamFactoryContext {
45 public:
46 RendererAudioOutputStreamFactoryContextImpl(
47 int render_process_id,
48 media::AudioSystem* audio_system,
49 media::AudioManager* audio_manager,
50 MediaStreamManager* media_stream_manager,
51 const std::string& salt);
52
53 ~RendererAudioOutputStreamFactoryContextImpl() override;
54
55 // Creates a factory and binds it to the request. Intended to be registered
56 // in a RenderFrameHosts InterfaceRegistry.
57 void CreateFactory(
58 int frame_host_id,
59 mojo::InterfaceRequest<mojom::RendererAudioOutputStreamFactory> request);
60
61 // RendererAudioOutputStreamFactoryContext implementation.
62 int GetRenderProcessId() const override;
63
64 std::string GetHMACForDeviceId(
65 const url::Origin& origin,
66 const std::string& raw_device_id) const override;
67
68 void RequestDeviceAuthorization(
69 int render_frame_id,
70 int session_id,
71 const std::string& device_id,
72 const url::Origin& security_origin,
73 AuthorizationCompletedCallback cb) const override;
74
75 std::unique_ptr<media::AudioOutputDelegate> CreateDelegate(
76 const std::string& unique_device_id,
77 int render_frame_id,
78 const media::AudioParameters& params,
79 media::AudioOutputDelegate::EventHandler* handler) override;
80
81 private:
82 // Used for hashing the device_id.
83 const std::string salt_;
84 media::AudioSystem* const audio_system_;
85 media::AudioManager* const audio_manager_;
86 MediaStreamManager* const media_stream_manager_;
87 const AudioOutputAuthorizationHandler authorization_handler_;
88 const int render_process_id_;
89
90 // All streams requires ids for logging, so we keep a count for that.
91 int next_stream_id_ = 0;
92
93 // The factories created by |this| is kept here, so that we can make sure they
94 // don't keep danging references to |this|.
95 mojo::StrongBindingSet<mojom::RendererAudioOutputStreamFactory> factories_;
96
97 DISALLOW_COPY_AND_ASSIGN(RendererAudioOutputStreamFactoryContextImpl);
98 };
99
100 } // namespace content
101
102 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_RENDERER_AUDIO_OUTPUT_STREAM_FACT ORY_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698