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