Skip to content

Commit 77c4334

Browse files
author
Miodrag
committed
Added the wrapper code in IDL and the generic glue code which still needs to be implemented to expose the raw audio buffers.
1 parent 73be1da commit 77c4334

File tree

53 files changed

+2211
-240
lines changed

Some content is hidden

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

53 files changed

+2211
-240
lines changed

idl/AudioBuffers.idl

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
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]
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+
int inputChannels;
66+
67+
/// <summary>
68+
/// Gets or sets the samples per input channel.
69+
/// <summary>
70+
int inputSamplesPerChannel;
71+
72+
/// <summary>
73+
/// Gets or sets the total number of process channels.
74+
/// <summary>
75+
int processChannels;
76+
77+
/// <summary>
78+
/// Gets or sets the samples per process channel.
79+
/// <summary>
80+
int procesSamplesPerChannel;
81+
82+
/// <summary>
83+
/// Gets or sets the total number of output channels.
84+
/// <summary>
85+
int 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 samples per input channel.
104+
/// <summary>
105+
int channels;
106+
107+
/// <summary>
108+
/// Gets or sets the samples per channel.
109+
/// <summary>
110+
int samplesPerChannel;
111+
};
112+
113+
[disposable]
114+
interface AudioBuffer
115+
{
116+
/// <summary>
117+
/// Constructs a new audio buffer from a configuration.
118+
/// </summary>
119+
[constructor, default]
120+
void AudioBuffer(AudioBufferConfiguration config);
121+
122+
/// <summary>
123+
/// Gets the total number of channels.
124+
/// <summary>
125+
[getter]
126+
int channels;
127+
128+
/// <summary>
129+
/// Gets the samples per channel.
130+
/// <summary>
131+
[getter]
132+
int samplesPerChannel;
133+
134+
/// <summary>
135+
/// Gets the audio samples for a given channel.
136+
/// <summary>
137+
AudioData channel(int channelIndex);
138+
139+
/// <summary>
140+
/// Gets the audio samples for data split by bands.
141+
/// <summary>
142+
AudioData splitBand(
143+
int channel,
144+
int band);
145+
146+
/// <summary>
147+
/// Gets the audio samples for data split by channels.
148+
/// <summary>
149+
AudioData splitChannel(
150+
int band,
151+
int channel);
152+
153+
/// <summary>
154+
/// Gets a read-only view of the mixed low pass data.
155+
/// </summary>
156+
[getter]
157+
AudioData mixedLowPassData;
158+
159+
/// <summary>
160+
/// Gets a read-only reference view of the low pass data.
161+
/// </summary>
162+
[getter]
163+
AudioData lowPassReference;
164+
165+
/// <summary>
166+
/// Gets or sets the voice activity flag.
167+
/// </summary>
168+
[getter, setter]
169+
VadActivity activity;
170+
171+
/// <summary>
172+
/// Deinterleaves samples from an audio frame.
173+
/// </summary>
174+
void deinterleaveFrom(AudioFrame frame);
175+
/// <summary>
176+
/// Interleaves samples from an audio frame.
177+
/// </summary>
178+
void interleaveTo(AudioFrame frame);
179+
180+
/// <summary>
181+
/// Copies the low pass data to the low pass reference.
182+
/// <summary>
183+
void copyLowPassToReference();
184+
185+
/// <summary>
186+
/// Splits the signal into different bands.
187+
/// </summary>
188+
void splitIntoFrequencyBands();
189+
/// <summary>
190+
/// Recombine the different bands into one signal.
191+
/// </summary>
192+
void mergeFrequencyBands();
193+
};
194+
195+
196+
}
197+
}

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/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

idl/VideoOptions.idl

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
38+
[dictionary]
39+
struct VideoOptions
40+
{
41+
/// <summary>
42+
/// Gets or sets the webrtc factory.
43+
/// </summary>
44+
WebRtcFactory factory;
45+
46+
/// <summary>
47+
/// Gets or sets the associated video capturer.
48+
/// </summary>
49+
VideoCapturer capturer;
50+
51+
/// <summary>
52+
/// Gets or sets the associated constraints.
53+
/// </summary>
54+
MediaConstraints constraints;
55+
};
56+
}
57+
}

idl/VideoTrackSource.idl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,10 @@ namespace org
5454
void VideoTrackSource();
5555

5656
/// <summary>
57-
/// Creates an VideoTrackSource for use with an MediaStreamTrack.
57+
/// Creates an VideoTrackSource for use with video options specified.
5858
/// </summary>
5959
[static, default]
60-
VideoTrackSource create(VideoCapturer capturer);
61-
62-
/// <summary>
63-
/// Creates a VideoTrackSource for use with an MediaStreamTrack.
64-
/// </summary>
65-
[static, default, altname(createWithContraints)]
66-
VideoTrackSource create(VideoCapturer capturer, MediaConstraints constraints);
60+
VideoTrackSource create(VideoOptions options);
6761

6862
/// <summary>
6963
/// Indicates that parameters suitable for screencasts should be automatically

0 commit comments

Comments
 (0)