| 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_INPUT_IPC_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_IPC_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_INPUT_IPC_H_ | 6 #define MEDIA_AUDIO_AUDIO_INPUT_IPC_H_ |
| 7 | 7 |
| 8 #include "base/shared_memory.h" | 8 #include "base/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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 base::SyncSocket::Handle socket_handle, | 36 base::SyncSocket::Handle socket_handle, |
| 37 int length, | 37 int length, |
| 38 int total_segments) = 0; | 38 int total_segments) = 0; |
| 39 | 39 |
| 40 // Called when state of an audio stream has changed. | 40 // Called when state of an audio stream has changed. |
| 41 virtual void OnStateChanged(State state) = 0; | 41 virtual void OnStateChanged(State state) = 0; |
| 42 | 42 |
| 43 // Called when the input stream volume has changed. | 43 // Called when the input stream volume has changed. |
| 44 virtual void OnVolume(double volume) = 0; | 44 virtual void OnVolume(double volume) = 0; |
| 45 | 45 |
| 46 // Called when a device has been started on the server side. | |
| 47 // If the device could not be started, |device_id| will be empty. | |
| 48 virtual void OnDeviceReady(const std::string& device_id) = 0; | |
| 49 | |
| 50 // Called when the AudioInputIPC object is going away and/or when the | 46 // Called when the AudioInputIPC object is going away and/or when the |
| 51 // IPC channel has been closed and no more IPC requests can be made. | 47 // IPC channel has been closed and no more IPC requests can be made. |
| 52 // Implementations must clear any references to the AudioInputIPC object | 48 // Implementations must clear any references to the AudioInputIPC object |
| 53 // at this point. | 49 // at this point. |
| 54 virtual void OnIPCClosed() = 0; | 50 virtual void OnIPCClosed() = 0; |
| 55 | 51 |
| 56 protected: | 52 protected: |
| 57 virtual ~AudioInputIPCDelegate(); | 53 virtual ~AudioInputIPCDelegate(); |
| 58 }; | 54 }; |
| 59 | 55 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 72 // calling this function. | 68 // calling this function. |
| 73 virtual void RemoveDelegate(int stream_id) = 0; | 69 virtual void RemoveDelegate(int stream_id) = 0; |
| 74 | 70 |
| 75 // Sends a request to create an AudioInputController object in the peer | 71 // Sends a request to create an AudioInputController object in the peer |
| 76 // process, identify it by |stream_id| and configure it to use the specified | 72 // process, identify it by |stream_id| and configure it to use the specified |
| 77 // audio |params|. The |total_segments| indidates number of equal-lengthed | 73 // audio |params|. The |total_segments| indidates number of equal-lengthed |
| 78 // segments in the shared memory buffer. | 74 // segments in the shared memory buffer. |
| 79 // Once the stream has been created, the implementation must | 75 // Once the stream has been created, the implementation must |
| 80 // generate a notification to the AudioInputIPCDelegate and call | 76 // generate a notification to the AudioInputIPCDelegate and call |
| 81 // OnStreamCreated(). | 77 // OnStreamCreated(). |
| 82 virtual void CreateStream( | 78 virtual void CreateStream(int stream_id, |
| 83 int stream_id, | 79 int session_id, |
| 84 const AudioParameters& params, | 80 const AudioParameters& params, |
| 85 const std::string& device_id, | 81 bool automatic_gain_control, |
| 86 bool automatic_gain_control, | 82 uint32 total_segments) = 0; |
| 87 uint32 total_segments) = 0; | |
| 88 | |
| 89 // Starts the device on the server side. Once the device has started, | |
| 90 // or failed to start, a callback to | |
| 91 // AudioInputIPCDelegate::OnDeviceReady() must be made. | |
| 92 virtual void StartDevice(int stream_id, int session_id) = 0; | |
| 93 | 83 |
| 94 // Corresponds to a call to AudioInputController::Record() on the server side. | 84 // Corresponds to a call to AudioInputController::Record() on the server side. |
| 95 virtual void RecordStream(int stream_id) = 0; | 85 virtual void RecordStream(int stream_id) = 0; |
| 96 | 86 |
| 97 // Sets the volume of the audio stream. | 87 // Sets the volume of the audio stream. |
| 98 virtual void SetVolume(int stream_id, double volume) = 0; | 88 virtual void SetVolume(int stream_id, double volume) = 0; |
| 99 | 89 |
| 100 // Closes the audio stream and deletes the matching AudioInputController | 90 // Closes the audio stream and deletes the matching AudioInputController |
| 101 // instance. Prior to deleting the AudioInputController object, a call to | 91 // instance. Prior to deleting the AudioInputController object, a call to |
| 102 // AudioInputController::Close must be made. | 92 // AudioInputController::Close must be made. |
| 103 virtual void CloseStream(int stream_id) = 0; | 93 virtual void CloseStream(int stream_id) = 0; |
| 104 | 94 |
| 105 protected: | 95 protected: |
| 106 virtual ~AudioInputIPC(); | 96 virtual ~AudioInputIPC(); |
| 107 }; | 97 }; |
| 108 | 98 |
| 109 } // namespace media | 99 } // namespace media |
| 110 | 100 |
| 111 #endif // MEDIA_AUDIO_AUDIO_INPUT_IPC_H_ | 101 #endif // MEDIA_AUDIO_AUDIO_INPUT_IPC_H_ |
| OLD | NEW |