Skip to content

Commit 55af2ad

Browse files
Merge pull request #17 from webrtc-uwp/Miodrag/m71-unity-audio-handler
Miodrag/m71 unity audio handler
2 parents 1c4088e + 8c42176 commit 55af2ad

File tree

104 files changed

+5956
-1168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+5956
-1168
lines changed

idl/AudioBuffers.idl

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
/*
2+
3+
Copyright (c) 2017, Optical Tone Ltd.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
26+
The views and conclusions contained in the software and documentation are those
27+
of the authors and should not be interpreted as representing official policies,
28+
either expressed or implied, of the FreeBSD Project.
29+
30+
*/
31+
32+
33+
namespace org
34+
{
35+
namespace webRtc
36+
{
37+
[special, disposable]
38+
interface AudioData
39+
{
40+
/// <summary>
41+
/// Constructs a new audio data object.
42+
/// <summary>
43+
[constructor, default]
44+
void AudioData();
45+
46+
/// <summary>
47+
/// Gets if the data is read-only.
48+
/// <summary>
49+
[getter]
50+
bool readOnly;
51+
52+
/// <summary>
53+
/// Gets or sets the audio samples data.
54+
/// <summary>
55+
[getter, setter]
56+
std::list<int16> data;
57+
};
58+
59+
[dictionary]
60+
struct AudioBufferConfiguration
61+
{
62+
/// <summary>
63+
/// Gets or sets the total number of input channels.
64+
/// <summary>
65+
size_t inputChannels;
66+
67+
/// <summary>
68+
/// Gets or sets the samples per input channel.
69+
/// <summary>
70+
size_t inputSamplesPerChannel;
71+
72+
/// <summary>
73+
/// Gets or sets the total number of process channels.
74+
/// <summary>
75+
size_t processChannels;
76+
77+
/// <summary>
78+
/// Gets or sets the samples per process channel.
79+
/// <summary>
80+
size_t procesSamplesPerChannel;
81+
82+
/// <summary>
83+
/// Gets or sets the total number of output channels.
84+
/// <summary>
85+
size_t outputChannels;
86+
};
87+
88+
[dictionary]
89+
struct AudioFrame
90+
{
91+
/// <summary>
92+
/// Contructs an audio frame.
93+
/// <summary>
94+
[constructor, default]
95+
void AudioFrame();
96+
97+
/// <summary>
98+
/// Gets or sets the audio frame data.
99+
/// <summary>
100+
AudioData data;
101+
102+
/// <summary>
103+
/// Gets or sets the voice activity flag.
104+
/// </summary>
105+
VadActivity activity;
106+
107+
/// <summary>
108+
/// Gets or sets the samples per input channel.
109+
/// <summary>
110+
size_t channels;
111+
112+
/// <summary>
113+
/// Gets or sets the samples per channel.
114+
/// <summary>
115+
size_t samplesPerChannel;
116+
};
117+
118+
[disposable]
119+
interface AudioBuffer
120+
{
121+
/// <summary>
122+
/// Constructs a new audio buffer from a configuration.
123+
/// </summary>
124+
[constructor, default]
125+
void AudioBuffer(AudioBufferConfiguration config);
126+
127+
/// <summary>
128+
/// Gets the total number of channels.
129+
/// <summary>
130+
[getter]
131+
size_t channels;
132+
133+
/// <summary>
134+
/// Gets the samples per channel.
135+
/// <summary>
136+
[getter]
137+
size_t samplesPerChannel;
138+
139+
/// <summary>
140+
/// Gets the total number of bands.
141+
/// <summary>
142+
[getter]
143+
size_t bands;
144+
145+
/// <summary>
146+
/// Gets the total number of frames per band.
147+
/// <summary>
148+
[getter]
149+
size_t framesPerBand;
150+
151+
/// <summary>
152+
/// Gets the audio samples for a given channel.
153+
/// <summary>
154+
AudioData channel(size_t channel);
155+
156+
/// <summary>
157+
/// Gets the audio samples for data split by bands.
158+
/// <summary>
159+
AudioData splitBand(
160+
size_t channel,
161+
Band band);
162+
163+
/// <summary>
164+
/// Gets the audio samples for data split by channels.
165+
/// <summary>
166+
AudioData splitChannel(
167+
Band band,
168+
size_t channel);
169+
170+
/// <summary>
171+
/// Gets a read-only view of the mixed low pass data.
172+
/// </summary>
173+
[getter]
174+
AudioData mixedLowPassData;
175+
176+
/// <summary>
177+
/// Gets a read-only reference view of the low pass data
178+
/// for a given channel.
179+
/// </summary>
180+
AudioData lowPassReference(size_t channel);
181+
182+
/// <summary>
183+
/// Gets or sets the voice activity flag.
184+
/// </summary>
185+
[getter, setter]
186+
VadActivity activity;
187+
188+
/// <summary>
189+
/// Deinterleaves samples from an audio frame.
190+
/// </summary>
191+
void deinterleaveFrom(AudioFrame frame);
192+
/// <summary>
193+
/// Interleaves samples from an audio frame.
194+
/// </summary>
195+
void interleaveTo(AudioFrame frame);
196+
197+
/// <summary>
198+
/// Copies the low pass data to the low pass reference.
199+
/// <summary>
200+
void copyLowPassToReference();
201+
202+
/// <summary>
203+
/// Splits the signal into different bands.
204+
/// </summary>
205+
void splitIntoFrequencyBands();
206+
/// <summary>
207+
/// Recombine the different bands into one signal.
208+
/// </summary>
209+
void mergeFrequencyBands();
210+
};
211+
212+
213+
}
214+
}

idl/AudioOptions.idl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ namespace org
3838
[dictionary]
3939
struct AudioOptions
4040
{
41+
/// <summary>
42+
/// Gets or sets the webrtc factory.
43+
/// </summary>
44+
WebRtcFactory factory;
45+
4146
/// <summary>
4247
/// Audio processing that attempts to filter away the output signal from
4348
/// later inbound pickup.

idl/Configuration.idl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ namespace org
4343
[dictionary]
4444
struct RTCConfiguration
4545
{
46+
/// <summary>
47+
/// Gets or sets the factory associated with the configuration.
48+
/// </summary>
49+
[getter, setter]
50+
WebRtcFactory factory;
51+
4652
[getter, setter]
4753
bool dscp;
4854

idl/MediaStreamTrack.idl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ namespace org
3434
{
3535
namespace webRtc
3636
{
37+
/// <summary>
38+
/// The event is fired when an audio buffer is ready for processing.
39+
/// <summary>
40+
[disposable]
41+
interface VideoFrameBufferEvent
42+
{
43+
[constructor, delete, default]
44+
void VideoFrameBufferEvent();
45+
46+
/// <summary>
47+
/// Gets the video buffer for further processing.
48+
/// <summary>
49+
[getter]
50+
VideoFrameBuffer buffer;
51+
};
52+
3753
/// <summary>
3854
/// A MediaStreamTrack object represents a media source in the User Agent.
3955
/// An example source is a device connected to the User Agent. Other
@@ -129,6 +145,12 @@ namespace org
129145
[event]
130146
void onFrameRateChanged(float frameRate);
131147

148+
/// <summary>
149+
/// Fires events when an video buffer is available.
150+
/// </summary>
151+
[event]
152+
void onVideoFrame(VideoFrameBufferEvent buffer);
153+
132154
};
133155
}
134156
}

idl/PeerConnection.idl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ namespace org
147147
/// established by RTCPeerConnection.
148148
/// </summary>
149149
[static]
150-
PromiseWithRTCCertificate generateCertificate(RTCKeyParams keygenAlgorithm);
150+
PromiseWithRTCCertificate generateCertificate(
151+
WebRtcFactory factory,
152+
RTCKeyParams keygenAlgorithm);
151153

152154
/// <summary>
153155
/// Constructs an RTCPeerConnection with an RTCConfiguration.
@@ -182,13 +184,13 @@ namespace org
182184
/// The setLocalDescription method instructs the RTCPeerConnection to
183185
/// apply the supplied RTCSessionDescriptionInit as the local description.
184186
/// </summary>
185-
Promise setLocalDescription(RTCSessionDescription constraints);
187+
Promise setLocalDescription(RTCSessionDescription description);
186188
/// <summary>
187189
/// The setRemoteDescription method instructs the RTCPeerConnection
188190
/// to apply the supplied RTCSessionDescriptionInit as the remote offer
189191
/// or answer. This API changes the local media state.
190192
/// </summary>
191-
Promise setRemoteDescription(RTCSessionDescription constraints);
193+
Promise setRemoteDescription(RTCSessionDescription description);
192194

193195
/// <summary>
194196
/// Returns an RTCConfiguration object representing the current

idl/RtpReceiver.idl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ namespace org
131131
/// to the value of the kind argument, getCapabilities returns null.
132132
/// <summary>
133133
[static]
134-
RTCRtpCapabilities getCapabilities(string kind);
134+
RTCRtpCapabilities getCapabilities(
135+
WebRtcFactory factory,
136+
string kind);
135137

136138
/// <summary>
137139
/// Gets the attribute for the track that is associated with

idl/RtpSender.idl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ namespace org
5757
/// argument, getCapabilities returns null.
5858
/// </summary>
5959
[static]
60-
RTCRtpCapabilities getCapabilities(string kind);
60+
RTCRtpCapabilities getCapabilities(
61+
WebRtcFactory factory,
62+
string kind);
6163

6264
/// <summary>
6365
/// Gets the attribute for the track that is associated with

0 commit comments

Comments
 (0)