| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // IPC messages for the audio. | 5 // IPC messages for the audio. |
| 6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
| 10 #include "base/sync_socket.h" | 10 #include "base/sync_socket.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 IPC_STRUCT_TRAITS_MEMBER(format) | 29 IPC_STRUCT_TRAITS_MEMBER(format) |
| 30 IPC_STRUCT_TRAITS_MEMBER(channel_layout) | 30 IPC_STRUCT_TRAITS_MEMBER(channel_layout) |
| 31 IPC_STRUCT_TRAITS_MEMBER(sample_rate) | 31 IPC_STRUCT_TRAITS_MEMBER(sample_rate) |
| 32 IPC_STRUCT_TRAITS_MEMBER(bits_per_sample) | 32 IPC_STRUCT_TRAITS_MEMBER(bits_per_sample) |
| 33 IPC_STRUCT_TRAITS_MEMBER(samples_per_packet) | 33 IPC_STRUCT_TRAITS_MEMBER(samples_per_packet) |
| 34 IPC_STRUCT_TRAITS_MEMBER(channels) | 34 IPC_STRUCT_TRAITS_MEMBER(channels) |
| 35 IPC_STRUCT_TRAITS_END() | 35 IPC_STRUCT_TRAITS_END() |
| 36 | 36 |
| 37 // Messages sent from the browser to the renderer. | 37 // Messages sent from the browser to the renderer. |
| 38 | 38 |
| 39 // Sent by AudioRendererHost to renderer to request an audio packet. | 39 // Tell the renderer process that an audio stream has been created. |
| 40 IPC_MESSAGE_CONTROL2(AudioMsg_RequestPacket, | 40 // The renderer process is given a shared memory handle for the audio data |
| 41 int /* stream id */, | 41 // buffer it shares with the browser process. It is also given a SyncSocket that |
| 42 AudioBuffersState) | 42 // it uses to communicate with the browser process about the state of the |
| 43 | 43 // buffered audio data. |
| 44 // Tell the renderer process that the audio stream has been created, renderer | |
| 45 // process would be given a ShareMemoryHandle that it should write to from | |
| 46 // then on. | |
| 47 IPC_MESSAGE_CONTROL3(AudioMsg_NotifyStreamCreated, | |
| 48 int /* stream id */, | |
| 49 base::SharedMemoryHandle /* handle */, | |
| 50 uint32 /* length */) | |
| 51 | |
| 52 // Tell the renderer process that a low latency audio stream has been created, | |
| 53 // renderer process would be given a SyncSocket that it should write to from | |
| 54 // then on. | |
| 55 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
| 56 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyLowLatencyStreamCreated, | 45 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyStreamCreated, |
| 57 int /* stream id */, | 46 int /* stream id */, |
| 58 base::SharedMemoryHandle /* handle */, | 47 base::SharedMemoryHandle /* handle */, |
| 59 base::SyncSocket::Handle /* socket handle */, | 48 base::SyncSocket::Handle /* socket handle */, |
| 60 uint32 /* length */) | 49 uint32 /* length */) |
| 61 #else | 50 #else |
| 62 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyLowLatencyStreamCreated, | 51 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyStreamCreated, |
| 63 int /* stream id */, | 52 int /* stream id */, |
| 64 base::SharedMemoryHandle /* handle */, | 53 base::SharedMemoryHandle /* handle */, |
| 65 base::FileDescriptor /* socket handle */, | 54 base::FileDescriptor /* socket handle */, |
| 66 uint32 /* length */) | 55 uint32 /* length */) |
| 67 #endif | 56 #endif |
| 68 | 57 |
| 69 // Tell the renderer process that a low latency audio input stream has been | 58 // Tell the renderer process that a low latency audio input stream has been |
| 70 // created, renderer process would be given a SyncSocket that it should read | 59 // created, renderer process would be given a SyncSocket that it should read |
| 71 // from from then on. | 60 // from from then on. |
| 72 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 87 // update after the renderer has requested a Create/Start/Close. | 76 // update after the renderer has requested a Create/Start/Close. |
| 88 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged, | 77 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged, |
| 89 int /* stream id */, | 78 int /* stream id */, |
| 90 AudioStreamState /* new state */) | 79 AudioStreamState /* new state */) |
| 91 | 80 |
| 92 // Notification message sent from browser to renderer for state update. | 81 // Notification message sent from browser to renderer for state update. |
| 93 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged, | 82 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged, |
| 94 int /* stream id */, | 83 int /* stream id */, |
| 95 AudioStreamState /* new state */) | 84 AudioStreamState /* new state */) |
| 96 | 85 |
| 97 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamVolume, | |
| 98 int /* stream id */, | |
| 99 double /* volume */) | |
| 100 | |
| 101 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume, | 86 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume, |
| 102 int /* stream id */, | 87 int /* stream id */, |
| 103 double /* volume */) | 88 double /* volume */) |
| 104 | 89 |
| 105 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyDeviceStarted, | 90 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyDeviceStarted, |
| 106 int /* stream id */, | 91 int /* stream id */, |
| 107 std::string /* device_id */) | 92 std::string /* device_id */) |
| 108 | 93 |
| 109 // Messages sent from the renderer to the browser. | 94 // Messages sent from the renderer to the browser. |
| 110 | 95 |
| 111 // Request that got sent to browser for creating an audio output stream | 96 // Request that got sent to browser for creating an audio output stream |
| 112 IPC_MESSAGE_CONTROL3(AudioHostMsg_CreateStream, | 97 IPC_MESSAGE_CONTROL2(AudioHostMsg_CreateStream, |
| 113 int /* stream_id */, | 98 int /* stream_id */, |
| 114 AudioParameters /* params */, | 99 AudioParameters /* params */) |
| 115 bool /* low-latency */) | |
| 116 | 100 |
| 117 // Request that got sent to browser for creating an audio input stream | 101 // Request that got sent to browser for creating an audio input stream |
| 118 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream, | 102 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream, |
| 119 int /* stream_id */, | 103 int /* stream_id */, |
| 120 AudioParameters /* params */, | 104 AudioParameters /* params */, |
| 121 bool /* low-latency */, | 105 bool /* low-latency */, |
| 122 std::string /* device_id */) | 106 std::string /* device_id */) |
| 123 | 107 |
| 124 // Tell the browser the audio buffer prepared for stream (stream_id) is | |
| 125 // filled and is ready to be consumed. | |
| 126 IPC_MESSAGE_CONTROL2(AudioHostMsg_NotifyPacketReady, | |
| 127 int /* stream_id */, | |
| 128 uint32 /* packet size */) | |
| 129 | |
| 130 // Start buffering and play the audio stream specified by stream_id. | 108 // Start buffering and play the audio stream specified by stream_id. |
| 131 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream, | 109 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream, |
| 132 int /* stream_id */) | 110 int /* stream_id */) |
| 133 | 111 |
| 134 // Start recording the audio input stream specified by stream_id. | 112 // Start recording the audio input stream specified by stream_id. |
| 135 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream, | 113 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream, |
| 136 int /* stream_id */) | 114 int /* stream_id */) |
| 137 | 115 |
| 138 // Pause the audio stream specified by stream_id. | 116 // Pause the audio stream specified by stream_id. |
| 139 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream, | 117 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream, |
| 140 int /* stream_id */) | 118 int /* stream_id */) |
| 141 | 119 |
| 142 // Discard all buffered audio data for the specified audio stream. | 120 // Discard all buffered audio data for the specified audio stream. |
| 143 IPC_MESSAGE_CONTROL1(AudioHostMsg_FlushStream, | 121 IPC_MESSAGE_CONTROL1(AudioHostMsg_FlushStream, |
| 144 int /* stream_id */) | 122 int /* stream_id */) |
| 145 | 123 |
| 146 // Close an audio stream specified by stream_id. | 124 // Close an audio stream specified by stream_id. |
| 147 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream, | 125 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream, |
| 148 int /* stream_id */) | 126 int /* stream_id */) |
| 149 | 127 |
| 150 // Close an audio input stream specified by stream_id. | 128 // Close an audio input stream specified by stream_id. |
| 151 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream, | 129 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream, |
| 152 int /* stream_id */) | 130 int /* stream_id */) |
| 153 | 131 |
| 154 // Get audio volume of the stream specified by stream_id. | |
| 155 IPC_MESSAGE_CONTROL1(AudioHostMsg_GetVolume, | |
| 156 int /* stream_id */) | |
| 157 | |
| 158 // Get audio volume of the input stream specified by | 132 // Get audio volume of the input stream specified by |
| 159 // (render_view_id, stream_id). | 133 // (render_view_id, stream_id). |
| 160 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_GetVolume, | 134 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_GetVolume, |
| 161 int /* stream_id */) | 135 int /* stream_id */) |
| 162 | 136 |
| 163 // Set audio volume of the stream specified by stream_id. | 137 // Set audio volume of the stream specified by stream_id. |
| 164 // TODO(hclam): change this to vector if we have channel numbers other than 2. | 138 // TODO(hclam): change this to vector if we have channel numbers other than 2. |
| 165 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume, | 139 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume, |
| 166 int /* stream_id */, | 140 int /* stream_id */, |
| 167 double /* volume */) | 141 double /* volume */) |
| 168 | 142 |
| 169 // Set audio volume of the input stream specified by stream_id. | 143 // Set audio volume of the input stream specified by stream_id. |
| 170 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume, | 144 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume, |
| 171 int /* stream_id */, | 145 int /* stream_id */, |
| 172 double /* volume */) | 146 double /* volume */) |
| 173 | 147 |
| 174 // Start the device referenced by the session_id for the input stream specified | 148 // Start the device referenced by the session_id for the input stream specified |
| 175 // by stream_id. | 149 // by stream_id. |
| 176 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_StartDevice, | 150 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_StartDevice, |
| 177 int /* stream_id */, | 151 int /* stream_id */, |
| 178 int /* session_id */) | 152 int /* session_id */) |
| OLD | NEW |