OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_H_ | 5 #ifndef MEDIA_BASE_AUDIO_OUTPUT_DELEGATE_H_ |
o1ka
2017/02/22 13:26:30
To me media/audio looks like a better place for it
Max Morin
2017/03/02 23:11:32
Done.
| |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_H_ | 6 #define MEDIA_BASE_AUDIO_OUTPUT_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "content/common/content_export.h" | 13 #include "media/base/media_export.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class SharedMemory; | 16 class SharedMemory; |
17 class CancelableSyncSocket; | 17 class CancelableSyncSocket; |
18 } | 18 } |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 | |
21 class AudioOutputController; | 22 class AudioOutputController; |
22 } | |
23 | 23 |
24 namespace content { | 24 class MEDIA_EXPORT AudioOutputDelegate { |
25 | |
26 class CONTENT_EXPORT AudioOutputDelegate { | |
27 public: | 25 public: |
28 class CONTENT_EXPORT EventHandler { | 26 class MEDIA_EXPORT EventHandler { |
29 public: | 27 public: |
30 virtual ~EventHandler() {} | 28 virtual ~EventHandler() {} |
31 | 29 |
32 // All these methods are called on the IO thread. | |
33 | |
34 // Called when construction is finished and the stream is ready for | 30 // Called when construction is finished and the stream is ready for |
35 // playout. | 31 // playout. |
36 virtual void OnStreamCreated(int stream_id, | 32 virtual void OnStreamCreated(int stream_id, |
37 base::SharedMemory* shared_memory, | 33 base::SharedMemory* shared_memory, |
38 base::CancelableSyncSocket* socket) = 0; | 34 base::CancelableSyncSocket* socket) = 0; |
39 | 35 |
40 // Called if stream encounters an error and has become unusable. | 36 // Called if stream encounters an error and has become unusable. |
41 virtual void OnStreamError(int stream_id) = 0; | 37 virtual void OnStreamError(int stream_id) = 0; |
42 }; | 38 }; |
43 | 39 |
44 virtual ~AudioOutputDelegate() {} | 40 virtual ~AudioOutputDelegate() {} |
45 | 41 |
46 // TODO(maxmorin): Remove GetController() when crbug.com/647185 is closed. | 42 // TODO(maxmorin): Remove GetController() when crbug.com/647185 is closed. |
47 // This function is used to provide control of the audio stream to | 43 // This function is used to provide control of the audio stream to |
48 // WebrtcAudioPrivateGetActiveSinkFunction and others in the webrtc extension | 44 // WebrtcAudioPrivateGetActiveSinkFunction and others in the webrtc extension |
49 // API. Since the controller is shared, this means that it might outlive the | 45 // API. Since the controller is shared, this means that it might outlive the |
50 // AudioOutputDelegate. In this case, it is still safe to call functions on | 46 // AudioOutputDelegate. In this case, it is still safe to call functions on |
51 // the controller, but it will not do anything. The controller is also shared | 47 // the controller, but it will not do anything. The controller is also shared |
52 // with AudioStreamMonitor. | 48 // with AudioStreamMonitor. |
53 virtual scoped_refptr<media::AudioOutputController> GetController() const = 0; | 49 virtual scoped_refptr<media::AudioOutputController> GetController() const = 0; |
54 virtual int GetStreamId() const = 0; | 50 virtual int GetStreamId() const = 0; |
55 | 51 |
56 // Stream control: | 52 // Stream control: |
57 virtual void OnPlayStream() = 0; | 53 virtual void OnPlayStream() = 0; |
58 virtual void OnPauseStream() = 0; | 54 virtual void OnPauseStream() = 0; |
59 virtual void OnSetVolume(double volume) = 0; | 55 virtual void OnSetVolume(double volume) = 0; |
60 }; | 56 }; |
61 | 57 |
62 } // namespace content | 58 } // namespace media |
63 | 59 |
64 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_OUTPUT_DELEGATE_H_ | 60 #endif // MEDIA_BASE_AUDIO_OUTPUT_DELEGATE_H_ |
OLD | NEW |