GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / common / media / audio_messages.h
blob57dd4a66b67945af617f71968b2c925ca4f86b92
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
3 // found in the LICENSE file.
5 // IPC messages for the audio.
6 // Multiply-included message file, hence no include guard.
8 #include "base/basictypes.h"
9 #include "base/memory/shared_memory.h"
10 #include "base/sync_socket.h"
11 #include "content/common/content_export.h"
12 #include "content/common/media/media_param_traits.h"
13 #include "ipc/ipc_message_macros.h"
14 #include "media/audio/audio_input_ipc.h"
15 #include "media/audio/audio_output_ipc.h"
16 #include "media/audio/audio_parameters.h"
18 #undef IPC_MESSAGE_EXPORT
19 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
20 #define IPC_MESSAGE_START AudioMsgStart
22 IPC_ENUM_TRAITS_MAX_VALUE(media::AudioInputIPCDelegate::State,
23 media::AudioInputIPCDelegate::kStateLast)
25 IPC_ENUM_TRAITS_MAX_VALUE(media::AudioOutputIPCDelegate::State,
26 media::AudioOutputIPCDelegate::kStateLast)
28 IPC_STRUCT_BEGIN(AudioInputHostMsg_CreateStream_Config)
29 IPC_STRUCT_MEMBER(media::AudioParameters, params)
30 IPC_STRUCT_MEMBER(bool, automatic_gain_control)
31 IPC_STRUCT_MEMBER(uint32, shared_memory_count)
32 IPC_STRUCT_END()
34 // Messages sent from the browser to the renderer.
36 // Tell the renderer process that an audio stream has been created.
37 // The renderer process is given a shared memory handle for the audio data
38 // buffer it shares with the browser process. It is also given a SyncSocket that
39 // it uses to communicate with the browser process about the state of the
40 // buffered audio data.
41 IPC_MESSAGE_CONTROL4(
42 AudioMsg_NotifyStreamCreated,
43 int /* stream id */,
44 base::SharedMemoryHandle /* handle */,
45 base::SyncSocket::TransitDescriptor /* socket descriptor */,
46 uint32 /* length */)
48 // Tell the renderer process that an audio input stream has been created.
49 // The renderer process would be given a SyncSocket that it should read
50 // from from then on. It is also given number of segments in shared memory.
51 IPC_MESSAGE_CONTROL5(
52 AudioInputMsg_NotifyStreamCreated,
53 int /* stream id */,
54 base::SharedMemoryHandle /* handle */,
55 base::SyncSocket::TransitDescriptor /* socket descriptor */,
56 uint32 /* length */,
57 uint32 /* segment count */)
59 // Notification message sent from AudioRendererHost to renderer for state
60 // update after the renderer has requested a Create/Start/Close.
61 IPC_MESSAGE_CONTROL2(AudioMsg_NotifyStreamStateChanged,
62 int /* stream id */,
63 media::AudioOutputIPCDelegate::State /* new state */)
65 // Notification message sent from browser to renderer for state update.
66 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamStateChanged,
67 int /* stream id */,
68 media::AudioInputIPCDelegate::State /* new state */)
70 IPC_MESSAGE_CONTROL2(AudioInputMsg_NotifyStreamVolume,
71 int /* stream id */,
72 double /* volume */)
74 // Messages sent from the renderer to the browser.
76 // Request that is sent to the browser for creating an audio output stream.
77 // |render_frame_id| is the routing ID for the RenderFrame producing the audio
78 // data.
79 IPC_MESSAGE_CONTROL4(AudioHostMsg_CreateStream,
80 int /* stream_id */,
81 int /* render_frame_id */,
82 int /* session_id */,
83 media::AudioParameters /* params */)
85 // Request that is sent to the browser for creating an audio input stream.
86 // |render_frame_id| is the routing ID for the RenderFrame consuming the audio
87 // data.
88 IPC_MESSAGE_CONTROL4(AudioInputHostMsg_CreateStream,
89 int /* stream_id */,
90 int /* render_frame_id */,
91 int /* session_id */,
92 AudioInputHostMsg_CreateStream_Config)
94 // Start buffering and play the audio stream specified by stream_id.
95 IPC_MESSAGE_CONTROL1(AudioHostMsg_PlayStream,
96 int /* stream_id */)
98 // Start recording the audio input stream specified by stream_id.
99 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_RecordStream,
100 int /* stream_id */)
102 // Pause the audio stream specified by stream_id.
103 IPC_MESSAGE_CONTROL1(AudioHostMsg_PauseStream,
104 int /* stream_id */)
106 // Close an audio stream specified by stream_id.
107 IPC_MESSAGE_CONTROL1(AudioHostMsg_CloseStream,
108 int /* stream_id */)
110 // Close an audio input stream specified by stream_id.
111 IPC_MESSAGE_CONTROL1(AudioInputHostMsg_CloseStream,
112 int /* stream_id */)
114 // Set audio volume of the stream specified by stream_id.
115 // TODO(hclam): change this to vector if we have channel numbers other than 2.
116 IPC_MESSAGE_CONTROL2(AudioHostMsg_SetVolume,
117 int /* stream_id */,
118 double /* volume */)
120 // Set audio volume of the input stream specified by stream_id.
121 IPC_MESSAGE_CONTROL2(AudioInputHostMsg_SetVolume,
122 int /* stream_id */,
123 double /* volume */)