Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ |
| 7 | 7 |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/sync_socket.h" | 9 #include "base/sync_socket.h" |
| 10 #include "media/audio/audio_parameters.h" | 10 #include "media/audio/audio_parameters.h" |
| 11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace media { |
| 14 | 14 |
| 15 // Current status of the audio output stream in the browser process. Browser | |
| 16 // sends information about the current playback state and error to the | |
| 17 // renderer process using this type. | |
| 18 enum AudioOutputIPCDelegateState { | |
| 19 AUDIO_OUTPUT_IPC_DELEGATE_STATE_PLAYING, | |
| 20 AUDIO_OUTPUT_IPC_DELEGATE_STATE_PAUSED, | |
| 21 AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR, | |
| 22 AUDIO_OUTPUT_IPC_DELEGATE_STATE_MAX = AUDIO_OUTPUT_IPC_DELEGATE_STATE_ERROR | |
|
Guido Urdaneta
2015/06/10 21:11:55
STATE_MAX, but it should be STATE_LAST
ncarter (slow)
2015/06/10 22:59:47
Thanks. I must have accidentally hit Ctrl+Z just b
| |
| 23 }; | |
| 24 | |
| 15 // Contains IPC notifications for the state of the server side | 25 // Contains IPC notifications for the state of the server side |
| 16 // (AudioOutputController) audio state changes and when an AudioOutputController | 26 // (AudioOutputController) audio state changes and when an AudioOutputController |
| 17 // has been created. Implemented by AudioOutputDevice. | 27 // has been created. Implemented by AudioOutputDevice. |
| 18 class MEDIA_EXPORT AudioOutputIPCDelegate { | 28 class MEDIA_EXPORT AudioOutputIPCDelegate { |
| 19 public: | 29 public: |
| 20 // Current status of the audio output stream in the browser process. Browser | |
| 21 // sends information about the current playback state and error to the | |
| 22 // renderer process using this type. | |
| 23 enum State { | |
| 24 kPlaying, | |
| 25 kPaused, | |
| 26 kError, | |
| 27 kStateLast = kError | |
| 28 }; | |
| 29 | 30 |
| 30 // Called when state of an audio stream has changed. | 31 // Called when state of an audio stream has changed. |
| 31 virtual void OnStateChanged(State state) = 0; | 32 virtual void OnStateChanged(AudioOutputIPCDelegateState state) = 0; |
| 32 | 33 |
| 33 // Called when an audio stream has been created. | 34 // Called when an audio stream has been created. |
| 34 // The shared memory |handle| points to a memory section that's used to | 35 // The shared memory |handle| points to a memory section that's used to |
| 35 // transfer audio buffers from the AudioOutputIPCDelegate back to the | 36 // transfer audio buffers from the AudioOutputIPCDelegate back to the |
| 36 // AudioRendererHost. The implementation of OnStreamCreated takes ownership. | 37 // AudioRendererHost. The implementation of OnStreamCreated takes ownership. |
| 37 // The |socket_handle| is used by AudioRendererHost to signal requests for | 38 // The |socket_handle| is used by AudioRendererHost to signal requests for |
| 38 // audio data to be written into the shared memory. The AudioOutputIPCDelegate | 39 // audio data to be written into the shared memory. The AudioOutputIPCDelegate |
| 39 // must read from this socket and provide audio whenever data (search for | 40 // must read from this socket and provide audio whenever data (search for |
| 40 // "pending_bytes") is received. | 41 // "pending_bytes") is received. |
| 41 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 42 virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 // AudioOutputController in the peer process. | 83 // AudioOutputController in the peer process. |
| 83 virtual void CloseStream() = 0; | 84 virtual void CloseStream() = 0; |
| 84 | 85 |
| 85 // Sets the volume of the audio stream. | 86 // Sets the volume of the audio stream. |
| 86 virtual void SetVolume(double volume) = 0; | 87 virtual void SetVolume(double volume) = 0; |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 } // namespace media | 90 } // namespace media |
| 90 | 91 |
| 91 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ | 92 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_IPC_H_ |
| OLD | NEW |