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