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

Side by Side Diff: content/browser/media/audio_output_impl.h

Issue 1896883002: Mojo interfaces needed for switching audio rendering stream creation and closing from IPC to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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_MEDIA_AUDIO_OUTPUT_IMPL_H_
6 #define CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_
7
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "base/id_map.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/thread_checker.h"
15 #include "content/browser/renderer_host/media/audio_renderer_host.h"
16 #include "content/common/content_export.h"
17 #include "media/mojo/interfaces/audio_output.mojom.h"
18 #include "mojo/public/cpp/bindings/interface_request.h"
19 #include "mojo/public/cpp/bindings/strong_binding.h"
20
21 namespace base {
22 class FilePath;
23 }
24
25 namespace content {
26
27 class CONTENT_EXPORT AudioOutputStreamImpl : public mojom::AudioOutputStream {
28 public:
29 explicit AudioOutputStreamImpl(
30 mojo::InterfaceRequest<mojom::AudioOutputStream> request,
31 int stream_id,
32 AudioRendererHost::AudioEntry* entry,
33 AudioRendererHost* audio_renderer_host);
34 void Close() override;
35 ~AudioOutputStreamImpl() override;
36
37 private:
38 mojo::Binding<mojom::AudioOutputStream> binding_;
39 int stream_id_;
40 AudioRendererHost::AudioEntry* entry_;
Henrik Grunell 2016/04/19 15:36:08 What's the lifetime of AudioOutputStreamImpl? I.e.
rchtara 2016/04/21 09:10:17 |audio_renderer_host_| is scoped_refptr in AudioOu
Henrik Grunell 2016/04/22 08:23:03 OK, but what if the reference is released before A
41 AudioRendererHost* audio_renderer_host_;
42 DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamImpl);
43 };
44
45 // This class must always be accessed from the creation thread.
46 class CONTENT_EXPORT AudioOutputImpl
47 : NON_EXPORTED_BASE(public mojom::AudioOutput) {
48 public:
49 AudioOutputImpl(mojom::AudioOutputRequest request);
50
51 ~AudioOutputImpl() override;
52
53 static void CreateService(
54 scoped_refptr<AudioRendererHost> audio_renderer_host,
55 mojom::AudioOutputRequest request) {
56 auto service = new AudioOutputImpl(std::move(request));
57 service->audio_renderer_host_ = audio_renderer_host;
58 audio_renderer_host->audio_output_impl_ = service;
59 }
60
61 void InitMojo(mojo::InterfaceRequest<mojom::AudioOutput> request);
62
63 mojom::AudioOutputStreamPtr* StreamFactory(
Henrik Grunell 2016/04/19 15:36:08 Who calls this function? Comments on the functions
rchtara 2016/04/21 09:10:17 Done.
Henrik Grunell 2016/04/22 08:23:03 Don't specify the function that calls it, that can
64 int stream_id,
65 AudioRendererHost::AudioEntry* entry,
66 AudioRendererHost* audio_renderer_host);
67
68 private:
69 void CreateStream(int stream_id,
70 int render_frame_id,
71 mojom::AudioOutputStreamParametersPtr params,
72 const CreateStreamCallback& callback) override;
73 void DoCloseStream(int32_t id);
74
75 // Mojo connection error callback.
76 void OnDisconnect(AudioOutputImpl* impl);
77
78 scoped_refptr<AudioRendererHost> audio_renderer_host_;
79 base::ThreadChecker thread_checker_;
80 mojo::StrongBinding<AudioOutput> binding_;
81 std::map<int, scoped_ptr<AudioOutputStreamImpl>> stream_impls;
Henrik Grunell 2016/04/19 15:36:08 Add trailing _ to member variable.
rchtara 2016/04/21 09:10:17 Done.
82 DISALLOW_COPY_AND_ASSIGN(AudioOutputImpl);
83 };
84
85 } // namespace content
86
87 #endif // CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698