OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // IPC messages for the audio. |
| 6 // Multiply-included message file, hence no include guard. |
| 7 |
| 8 #include "base/shared_memory.h" |
| 9 #include "base/sync_socket.h" |
| 10 #include "content/common/audio_stream_state.h" |
| 11 #include "ipc/ipc_message_macros.h" |
| 12 #include "media/audio/audio_buffers_state.h" |
| 13 #include "media/audio/audio_parameters.h" |
| 14 |
| 15 #define IPC_MESSAGE_START AudioMsgStart |
| 16 |
| 17 IPC_ENUM_TRAITS(AudioStreamState) |
| 18 IPC_ENUM_TRAITS(AudioParameters::Format) |
| 19 |
| 20 IPC_STRUCT_TRAITS_BEGIN(AudioBuffersState) |
| 21 IPC_STRUCT_TRAITS_MEMBER(pending_bytes) |
| 22 IPC_STRUCT_TRAITS_MEMBER(hardware_delay_bytes) |
| 23 IPC_STRUCT_TRAITS_MEMBER(timestamp) |
| 24 IPC_STRUCT_TRAITS_END() |
| 25 |
| 26 IPC_STRUCT_TRAITS_BEGIN(AudioParameters) |
| 27 IPC_STRUCT_TRAITS_MEMBER(format) |
| 28 IPC_STRUCT_TRAITS_MEMBER(channels) |
| 29 IPC_STRUCT_TRAITS_MEMBER(sample_rate) |
| 30 IPC_STRUCT_TRAITS_MEMBER(bits_per_sample) |
| 31 IPC_STRUCT_TRAITS_MEMBER(samples_per_packet) |
| 32 IPC_STRUCT_TRAITS_END() |
| 33 |
| 34 // Messages sent from the browser to the renderer. |
| 35 |
| 36 // Sent by AudioRendererHost to renderer to request an audio packet. |
| 37 IPC_MESSAGE_ROUTED2(AudioMsg_RequestPacket, |
| 38 int /* stream id */, |
| 39 AudioBuffersState) |
| 40 |
| 41 // Tell the renderer process that the audio stream has been created, renderer |
| 42 // process would be given a ShareMemoryHandle that it should write to from |
| 43 // then on. |
| 44 IPC_MESSAGE_ROUTED3(AudioMsg_NotifyStreamCreated, |
| 45 int /* stream id */, |
| 46 base::SharedMemoryHandle /* handle */, |
| 47 uint32 /* length */) |
| 48 |
| 49 // Tell the renderer process that a low latency audio stream has been created, |
| 50 // renderer process would be given a SyncSocket that it should write to from |
| 51 // then on. |
| 52 #if defined(OS_WIN) |
| 53 IPC_MESSAGE_ROUTED4(AudioMsg_NotifyLowLatencyStreamCreated, |
| 54 int /* stream id */, |
| 55 base::SharedMemoryHandle /* handle */, |
| 56 base::SyncSocket::Handle /* socket handle */, |
| 57 uint32 /* length */) |
| 58 #else |
| 59 IPC_MESSAGE_ROUTED4(AudioMsg_NotifyLowLatencyStreamCreated, |
| 60 int /* stream id */, |
| 61 base::SharedMemoryHandle /* handle */, |
| 62 base::FileDescriptor /* socket handle */, |
| 63 uint32 /* length */) |
| 64 #endif |
| 65 |
| 66 // Notification message sent from AudioRendererHost to renderer for state |
| 67 // update after the renderer has requested a Create/Start/Close. |
| 68 IPC_MESSAGE_ROUTED2(AudioMsg_NotifyStreamStateChanged, |
| 69 int /* stream id */, |
| 70 AudioStreamState /* new state */) |
| 71 |
| 72 IPC_MESSAGE_ROUTED2(AudioMsg_NotifyStreamVolume, |
| 73 int /* stream id */, |
| 74 double /* volume */) |
| 75 |
| 76 // Messages sent from the renderer to the browser. |
| 77 |
| 78 // Request that got sent to browser for creating an audio output stream |
| 79 IPC_MESSAGE_ROUTED3(AudioHostMsg_CreateStream, |
| 80 int /* stream_id */, |
| 81 AudioParameters /* params */, |
| 82 bool /* low-latency */) |
| 83 |
| 84 // Tell the browser the audio buffer prepared for stream |
| 85 // (render_view_id, stream_id) is filled and is ready to be consumed. |
| 86 IPC_MESSAGE_ROUTED2(AudioHostMsg_NotifyPacketReady, |
| 87 int /* stream_id */, |
| 88 uint32 /* packet size */) |
| 89 |
| 90 // Start buffering and play the audio stream specified by |
| 91 // (render_view_id, stream_id). |
| 92 IPC_MESSAGE_ROUTED1(AudioHostMsg_PlayStream, |
| 93 int /* stream_id */) |
| 94 |
| 95 // Pause the audio stream specified by (render_view_id, stream_id). |
| 96 IPC_MESSAGE_ROUTED1(AudioHostMsg_PauseStream, |
| 97 int /* stream_id */) |
| 98 |
| 99 // Discard all buffered audio data for the specified audio stream. |
| 100 IPC_MESSAGE_ROUTED1(AudioHostMsg_FlushStream, |
| 101 int /* stream_id */) |
| 102 |
| 103 // Close an audio stream specified by (render_view_id, stream_id). |
| 104 IPC_MESSAGE_ROUTED1(AudioHostMsg_CloseStream, |
| 105 int /* stream_id */) |
| 106 |
| 107 // Get audio volume of the stream specified by (render_view_id, stream_id). |
| 108 IPC_MESSAGE_ROUTED1(AudioHostMsg_GetVolume, |
| 109 int /* stream_id */) |
| 110 |
| 111 // Set audio volume of the stream specified by (render_view_id, stream_id). |
| 112 // TODO(hclam): change this to vector if we have channel numbers other than 2. |
| 113 IPC_MESSAGE_ROUTED2(AudioHostMsg_SetVolume, |
| 114 int /* stream_id */, |
| 115 double /* volume */) |
OLD | NEW |