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

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

Issue 1856673002: Mojofication of the Chrome Audio Rendering Prototype Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/media/audio_output_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/common/media/audio_output.mojom.h"
18 #include "mojo/public/cpp/bindings/binding.h"
19 #include "mojo/public/cpp/bindings/interface_request.h"
20
21 namespace base {
22 class FilePath;
23 }
24
25 namespace content {
26
27 class AudioOutputStreamImpl : public mojom::AudioOutputStream {
28 public:
29 explicit AudioOutputStreamImpl(
30 mojo::InterfaceRequest<mojom::AudioOutputStream> request,
31 AudioEntry* entry,
32 int stream_id,
33 AudioRendererHost* audio_renderer_host);
34 void set(int a) override;
35 void Play(const PlayCallback& callback) override;
36 ~AudioOutputStreamImpl() override;
37
38 private:
39 int a_;
40 mojo::Binding<mojom::AudioOutputStream> binding_;
41 AudioEntry* entry_;
42 int stream_id_;
43 AudioRendererHost* audio_renderer_host_;
44 DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamImpl);
45 };
46
47 // This class must always be accessed from the creation thread.
48 class CONTENT_EXPORT AudioOutputImpl
49 : NON_EXPORTED_BASE(public mojom::AudioOutput) {
50 public:
51 AudioOutputImpl(AudioRendererHost* audio_renderer_host,
52 mojom::AudioOutputRequest request);
53
54 ~AudioOutputImpl() override;
55
56 static void Create(scoped_refptr<AudioRendererHost> audio_renderer_host,
57 mojom::AudioOutputRequest request) {
58 new AudioOutputImpl(audio_renderer_host.get(), std::move(request));
59 }
60
61 int render_host_id() const { return render_host_id_; }
62 void InitMojo(mojo::InterfaceRequest<mojom::AudioOutput> request);
63
64 static mojom::AudioOutputStreamPtr* CreateStream(AudioEntry* entry,
65 int stream_id);
66
67 // static scoped_ptr<AudioOutputStreamImpl> stream_ptr;
68 private:
69 void CloseStream(int32_t id) override;
70 void CreateStream(int stream_id,
71 int render_frame_id,
72 mojom::AudioOutputStreamParametersPtr params,
73 const CreateStreamCallback& callback) override;
74 void DoCloseStream(int32_t id);
75
76 // Mojo connection error callback.
77 void OnDisconnect(AudioOutputImpl* impl);
78
79 // Render process host ID.
80 int render_host_id_;
81
82 static AudioRendererHost* audio_renderer_host_;
83
84 base::ThreadChecker thread_checker_;
85 mojo::Binding<AudioOutput> binding_;
86
87 DISALLOW_COPY_AND_ASSIGN(AudioOutputImpl);
88 };
89
90 } // namespace content
91
92 #endif // CONTENT_BROWSER_MEDIA_AUDIO_OUTPUT_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/media/audio_output_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698