OLD | NEW |
---|---|
(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_RENDERER_MEDIA_MOJO_AUDIO_OUTPUT_IPC_H_ | |
6 #define CONTENT_RENDERER_MEDIA_MOJO_AUDIO_OUTPUT_IPC_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "base/threading/thread_checker.h" | |
13 #include "content/common/media/renderer_audio_output_stream_factory.mojom.h" | |
14 #include "media/audio/audio_output_ipc.h" | |
15 | |
16 namespace content { | |
17 | |
18 // MojoAudioOutputIPC is a renderer-side class for handling creation, | |
19 // initialization and control of an output stream. | |
o1ka
2017/04/20 10:36:00
Could you add a comment on threading (it can run o
Max Morin
2017/05/05 13:10:59
In the current version, it may only be used on a s
| |
20 class MojoAudioOutputIPC : public media::AudioOutputIPC { | |
21 public: | |
22 explicit MojoAudioOutputIPC(int frame_id); | |
23 | |
24 ~MojoAudioOutputIPC() override; | |
25 | |
26 // AudioOutputIPC implementation. | |
27 void RequestDeviceAuthorization(media::AudioOutputIPCDelegate* delegate, | |
28 int session_id, | |
29 const std::string& device_id, | |
30 const url::Origin& security_origin) override; | |
31 void CreateStream(media::AudioOutputIPCDelegate* delegate, | |
32 const media::AudioParameters& params) override; | |
33 void PlayStream() override; | |
34 void PauseStream() override; | |
35 void CloseStream() override; | |
36 void SetVolume(double volume) override; | |
37 | |
38 private: | |
39 media::mojom::AudioOutputStreamProviderRequest MakeProviderRequest( | |
40 media::AudioOutputIPCDelegate* delegate); | |
41 | |
42 void RecievedDeviceAuthorization(media::AudioOutputIPCDelegate* delegate, | |
43 media::OutputDeviceStatus status, | |
44 const media::AudioParameters& params, | |
45 const std::string& device_id) const; | |
46 | |
47 void StreamCreated(media::AudioOutputIPCDelegate* delegate, | |
48 mojo::ScopedSharedBufferHandle shared_memory, | |
49 mojo::ScopedHandle socket); | |
50 | |
51 base::ThreadChecker thread_checker_; | |
o1ka
2017/04/20 10:36:00
it can run on AudioIPCFactory::io_task_runner only
Max Morin
2017/05/05 13:10:59
See above.
| |
52 const int frame_id_; | |
53 | |
54 media::mojom::AudioOutputStreamProviderPtr stream_provider_; | |
55 media::mojom::AudioOutputStreamPtr stream_; | |
56 | |
57 // To make sure we don't send an "authorization completed" callback for a | |
58 // stream after it's closed, we use this weak factory. | |
59 base::WeakPtrFactory<MojoAudioOutputIPC> weak_factory_; | |
60 | |
61 DISALLOW_COPY_AND_ASSIGN(MojoAudioOutputIPC); | |
62 }; | |
63 | |
64 } // namespace content | |
65 | |
66 #endif // CONTENT_RENDERER_MEDIA_MOJO_AUDIO_OUTPUT_IPC_H_ | |
OLD | NEW |