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_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 30 matching lines...) Expand all Loading... | |
| 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. | 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. | 46 // If the device could not be started, |device_id| will be empty. |
| 47 virtual void OnDeviceReady(const std::string& device_id) = 0; | 47 virtual void OnDeviceReady(const std::string& device_id) = 0; |
| 48 | 48 |
| 49 // Called when the AudioInputIPC object is going away and/or when the | 49 // 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. | 50 // IPC channel has been closed and no more IPC requests can be made. |
| 51 // Implementations must clear any references to the AudioInputIPC object | 51 // Implementations should delete their owned AudioInputIPC instance |
| 52 // at this point. | 52 // immediately. |
| 53 virtual void OnIPCClosed() = 0; | 53 virtual void OnIPCClosed() = 0; |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 virtual ~AudioInputIPCDelegate(); | 56 virtual ~AudioInputIPCDelegate(); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Provides IPC functionality for an AudioInputDevice. The implementation | 59 // Provides IPC functionality for an AudioInputIPCDelegate (e.g., and |
| 60 // should asynchronously deliver the messages to an AudioInputController object | 60 // AudioInputDevice. The implementation should asynchronously deliver the |
| 61 // (or create one in the case of CreateStream()), that may live in a separate | 61 // messages to an AudioInputController object (or create one in the case of |
| 62 // process. | 62 // CreateStream()), that may live in a separate process. |
| 63 class MEDIA_EXPORT AudioInputIPC { | 63 class MEDIA_EXPORT AudioInputIPC { |
| 64 public: | 64 public: |
| 65 // Registers an AudioInputIPCDelegate and returns a |stream_id| that | 65 virtual ~AudioInputIPC(); |
| 66 // must be used with all other IPC functions in this interface. | |
| 67 virtual int AddDelegate(AudioInputIPCDelegate* delegate) = 0; | |
| 68 | |
| 69 // Unregisters a delegate that was previously registered via a call to | |
| 70 // AddDelegate(). The audio stream should be in a closed state prior to | |
| 71 // calling this function. | |
| 72 virtual void RemoveDelegate(int stream_id) = 0; | |
| 73 | 66 |
| 74 // Sends a request to create an AudioInputController object in the peer | 67 // 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 | 68 // process and configures it to use the specified audio |params|. Once the |
| 76 // audio |params|. Once the stream has been created, the implementation must | 69 // stream has been created, the implementation will notify |delegate| by |
| 77 // generate a notification to the AudioInputIPCDelegate and call | 70 // calling OnStreamCreated(). |
| 78 // OnStreamCreated(). | 71 virtual void CreateStream(AudioInputIPCDelegate* delegate, |
| 79 virtual void CreateStream(int stream_id, const AudioParameters& params, | 72 const AudioParameters& params, |
| 80 const std::string& device_id, bool automatic_gain_control) = 0; | 73 const std::string& device_id, |
|
palmer
2013/03/05 21:09:32
Same, no string.
DaleCurtis
2013/03/05 23:29:54
I think this is a change for a separate CL if it e
miu
2013/03/06 22:36:52
Definitely falls within the scope of http://crbug.
| |
| 74 bool automatic_gain_control) = 0; | |
| 81 | 75 |
| 82 // Starts the device on the server side. Once the device has started, | 76 // Starts the device on the server side. Once the device has started, |
| 83 // or failed to start, a callback to | 77 // or failed to start, a callback to |
| 84 // AudioInputIPCDelegate::OnDeviceReady() must be made. | 78 // AudioInputIPCDelegate::OnDeviceReady() will be made. |
| 85 virtual void StartDevice(int stream_id, int session_id) = 0; | 79 // |
| 80 // TODO(miu): Merge StartDevice into CreateStream (http://crbug.com/179597). | |
| 81 virtual void StartDevice(AudioInputIPCDelegate* delegate, int session_id) = 0; | |
| 86 | 82 |
| 87 // Corresponds to a call to AudioInputController::Record() on the server side. | 83 // Corresponds to a call to AudioInputController::Record() on the server side. |
| 88 virtual void RecordStream(int stream_id) = 0; | 84 virtual void RecordStream() = 0; |
| 89 | 85 |
| 90 // Sets the volume of the audio stream. | 86 // Sets the volume of the audio stream. |
| 91 virtual void SetVolume(int stream_id, double volume) = 0; | 87 virtual void SetVolume(double volume) = 0; |
| 92 | 88 |
| 93 // Closes the audio stream and deletes the matching AudioInputController | 89 // Closes the audio stream which should shut down the corresponding |
| 94 // instance. Prior to deleting the AudioInputController object, a call to | 90 // AudioInputController in the peer process. |
| 95 // AudioInputController::Close must be made. | 91 virtual void CloseStream() = 0; |
| 96 virtual void CloseStream(int stream_id) = 0; | |
| 97 | |
| 98 protected: | |
| 99 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 |