Chromium Code Reviews| 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. | |
| 40 IPC_MESSAGE_CONTROL2(AudioMsg_RequestPacket, | |
| 41 int /* stream id */, | |
| 42 AudioBuffersState) | |
| 43 | |
| 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, | 39 // Tell the renderer process that a low latency audio stream has been created, |
|
scherkus (not reviewing)
2012/02/01 22:56:12
update docs?
vrk (LEFT CHROMIUM)
2012/02/02 21:05:41
Done.
| |
| 53 // renderer process would be given a SyncSocket that it should write to from | 40 // renderer process would be given a SyncSocket that it should write to from |
| 54 // then on. | 41 // then on. |
| 55 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 56 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyLowLatencyStreamCreated, | 43 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyStreamCreated, |
| 57 int /* stream id */, | 44 int /* stream id */, |
| 58 base::SharedMemoryHandle /* handle */, | 45 base::SharedMemoryHandle /* handle */, |
| 59 base::SyncSocket::Handle /* socket handle */, | 46 base::SyncSocket::Handle /* socket handle */, |
| 60 uint32 /* length */) | 47 uint32 /* length */) |
| 61 #else | 48 #else |
| 62 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyLowLatencyStreamCreated, | 49 IPC_MESSAGE_CONTROL4(AudioMsg_NotifyStreamCreated, |
| 63 int /* stream id */, | 50 int /* stream id */, |
| 64 base::SharedMemoryHandle /* handle */, | 51 base::SharedMemoryHandle /* handle */, |
| 65 base::FileDescriptor /* socket handle */, | 52 base::FileDescriptor /* socket handle */, |
| 66 uint32 /* length */) | 53 uint32 /* length */) |
| 67 #endif | 54 #endif |
| 68 | 55 |
| 69 // Tell the renderer process that a low latency audio input stream has been | 56 // 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 | 57 // created, renderer process would be given a SyncSocket that it should read |
| 71 // from from then on. | 58 // from from then on. |
| 72 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 87 // update after the renderer has requested a Create/Start/Close. | 74 // update after the renderer has requested a Create/Start/Close. |
| 88 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged, | 75 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged, |
| 89 int /* stream id */, | 76 int /* stream id */, |
| 90 AudioStreamState /* new state */) | 77 AudioStreamState /* new state */) |
| 91 | 78 |
| 92 // Notification message sent from browser to renderer for state update. | 79 // Notification message sent from browser to renderer for state update. |
| 93 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged, | 80 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged, |
| 94 int /* stream id */, | 81 int /* stream id */, |
| 95 AudioStreamState /* new state */) | 82 AudioStreamState /* new state */) |
| 96 | 83 |
| 97 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamVolume, | |
| 98 int /* stream id */, | |
| 99 double /* volume */) | |
| 100 | |
| 101 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume, | 84 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume, |
| 102 int /* stream id */, | 85 int /* stream id */, |
| 103 double /* volume */) | 86 double /* volume */) |
| 104 | 87 |
| 105 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyDeviceStarted, | 88 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyDeviceStarted, |
| 106 int /* stream id */, | 89 int /* stream id */, |
| 107 std::string /* device_id */) | 90 std::string /* device_id */) |
| 108 | 91 |
| 109 // Messages sent from the renderer to the browser. | 92 // Messages sent from the renderer to the browser. |
| 110 | 93 |
| 111 // Request that got sent to browser for creating an audio output stream | 94 // Request that got sent to browser for creating an audio output stream |
| 112 IPC_MESSAGE_CONTROL3(AudioHostMsg_CreateStream, | 95 IPC_MESSAGE_CONTROL2(AudioHostMsg_CreateStream, |
| 113 int /* stream_id */, | 96 int /* stream_id */, |
| 114 AudioParameters /* params */, | 97 AudioParameters /* params */) |
| 115 bool /* low-latency */) | |
| 116 | 98 |
| 117 // Request that got sent to browser for creating an audio input stream | 99 // Request that got sent to browser for creating an audio input stream |
| 118 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream, | 100 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream, |
| 119 int /* stream_id */, | 101 int /* stream_id */, |
| 120 AudioParameters /* params */, | 102 AudioParameters /* params */, |
| 121 bool /* low-latency */, | 103 bool /* low-latency */, |
| 122 std::string /* device_id */) | 104 std::string /* device_id */) |
| 123 | 105 |
| 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. | 106 // Start buffering and play the audio stream specified by stream_id. |
| 131 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream, | 107 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream, |
| 132 int /* stream_id */) | 108 int /* stream_id */) |
| 133 | 109 |
| 134 // Start recording the audio input stream specified by stream_id. | 110 // Start recording the audio input stream specified by stream_id. |
| 135 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream, | 111 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream, |
| 136 int /* stream_id */) | 112 int /* stream_id */) |
| 137 | 113 |
| 138 // Pause the audio stream specified by stream_id. | 114 // Pause the audio stream specified by stream_id. |
| 139 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream, | 115 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream, |
| 140 int /* stream_id */) | 116 int /* stream_id */) |
| 141 | 117 |
| 142 // Discard all buffered audio data for the specified audio stream. | 118 // Discard all buffered audio data for the specified audio stream. |
| 143 IPC_MESSAGE_CONTROL1(AudioHostMsg_FlushStream, | 119 IPC_MESSAGE_CONTROL1(AudioHostMsg_FlushStream, |
| 144 int /* stream_id */) | 120 int /* stream_id */) |
| 145 | 121 |
| 146 // Close an audio stream specified by stream_id. | 122 // Close an audio stream specified by stream_id. |
| 147 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream, | 123 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream, |
| 148 int /* stream_id */) | 124 int /* stream_id */) |
| 149 | 125 |
| 150 // Close an audio input stream specified by stream_id. | 126 // Close an audio input stream specified by stream_id. |
| 151 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream, | 127 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream, |
| 152 int /* stream_id */) | 128 int /* stream_id */) |
| 153 | 129 |
| 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 | 130 // Get audio volume of the input stream specified by |
| 159 // (render_view_id, stream_id). | 131 // (render_view_id, stream_id). |
| 160 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_GetVolume, | 132 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_GetVolume, |
| 161 int /* stream_id */) | 133 int /* stream_id */) |
| 162 | 134 |
| 163 // Set audio volume of the stream specified by stream_id. | 135 // 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. | 136 // TODO(hclam): change this to vector if we have channel numbers other than 2. |
| 165 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume, | 137 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume, |
| 166 int /* stream_id */, | 138 int /* stream_id */, |
| 167 double /* volume */) | 139 double /* volume */) |
| 168 | 140 |
| 169 // Set audio volume of the input stream specified by stream_id. | 141 // Set audio volume of the input stream specified by stream_id. |
| 170 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume, | 142 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume, |
| 171 int /* stream_id */, | 143 int /* stream_id */, |
| 172 double /* volume */) | 144 double /* volume */) |
| 173 | 145 |
| 174 // Start the device referenced by the session_id for the input stream specified | 146 // Start the device referenced by the session_id for the input stream specified |
| 175 // by stream_id. | 147 // by stream_id. |
| 176 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_StartDevice, | 148 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_StartDevice, |
| 177 int /* stream_id */, | 149 int /* stream_id */, |
| 178 int /* session_id */) | 150 int /* session_id */) |
| OLD | NEW |