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

Side by Side Diff: content/renderer/media/audio_output_client.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
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_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_
6 #define CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_
7
8 #include <map>
9
10 #include "base/files/file.h"
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/shared_memory_handle.h"
15 #include "base/sync_socket.h"
16 #include "base/threading/thread_checker.h"
17 #include "content/common/content_export.h"
18 #include "content/common/media/audio_output.mojom.h"
19 #include "mojo/public/cpp/bindings/binding.h"
20 #include "mojo/public/cpp/bindings/interface_request.h"
21
22 namespace base {
23 class SingleThreadTaskRunner;
24 }
25
26 namespace media {
27 class AudioParameters;
28 }
29
30 namespace content {
31
32 class ServiceRegistry;
33
34 // All functions must only be accessed from the creation thread.
35 class CONTENT_EXPORT AudioOutputClient {
36 public:
37 explicit AudioOutputClient(ServiceRegistry* service_registry);
38
39 // Getter for the one AudioOutputClient object.
40 static AudioOutputClient* Get();
41
42 ~AudioOutputClient();
43
44 void CreateStream(int stream_id_,
45 int render_frame_id_,
46 const media::AudioParameters& params);
47 void CreateStreamCallback(mojom::AudioOutputStreamPtr stream,
48 int stream_id,
49 mojo::ScopedSharedBufferHandle shared_buffer,
50 mojo::ScopedHandle socket_descriptor);
51 void CreateStreamOnIOThread(
52 mojom::AudioOutputStreamPtr* stream,
53 int stream_id,
54 base::SharedMemoryHandle handle,
55 base::SyncSocket::TransitDescriptor socket_descriptor,
56 uint32_t length);
57 void CreateStreamOnMainThread(int stream_id,
58 int render_frame_id,
59 const media::AudioParameters& params);
60
61 void PlayStreamCallback(bool success);
62 void PlayStream(mojom::AudioOutputStreamPtr* stream);
63 void PlayStreamOnMainThread(mojom::AudioOutputStreamPtr* stream);
64
65 void CloseStream(int id);
66 void CloseStreamOnMainThread(int id);
67
68 void ReportErrorOnIOThread(int stream_id);
69
70 private:
71 friend class base::RefCountedThreadSafe<AudioOutputClient>;
72
73 // Mojo connection error handler.
74 void OnConnectionError();
75
76 // The Mojo service for registering observers to listen for enable/disable
77 // events.
78 mojom::AudioOutputPtr service_;
79 std::map<int, mojom::AudioOutputStreamPtr*> streams_;
80
81 // The singleton instance for this.
82 static AudioOutputClient* g_filter;
83
84 base::ThreadChecker thread_checker_;
85 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
86
87 DISALLOW_COPY_AND_ASSIGN(AudioOutputClient);
88 };
89
90 } // namespace content
91
92 #endif // CONTENT_RENDERER_MEDIA_AUDIO_OUTPUT_CLIENT_H_
OLDNEW
« no previous file with comments | « content/renderer/media/audio_message_filter.cc ('k') | content/renderer/media/audio_output_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698