Skip to content

Commit 28aeb2f

Browse files
PertsevRomanneilcsmith-net
authored andcommitted
gathering state (#155)
1 parent f77c505 commit 28aeb2f

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

src/org/freedesktop/gstreamer/webrtc/WebRTCBin.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,15 @@ public WebRTCPeerConnectionState getConnectionState() {
266266
return NativeEnum.fromInt(WebRTCPeerConnectionState.class, (Integer) get("connection-state"));
267267
}
268268

269+
/**
270+
* Retrieve ICE gathering state this {@link WebRTCBin} is currently in
271+
*
272+
* @return a {@link WebRTCICEGatheringState} describing gathering state
273+
*/
274+
public WebRTCICEGatheringState getICEGatheringState() {
275+
return NativeEnum.fromInt(WebRTCICEGatheringState.class, (Integer) get("ice-gathering-state"));
276+
}
277+
269278
/**
270279
* Retrieve the local description for this {@link WebRTCBin}
271280
*
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.freedesktop.gstreamer.webrtc;
2+
3+
import org.freedesktop.gstreamer.Gst;
4+
import org.freedesktop.gstreamer.glib.NativeEnum;
5+
6+
/**
7+
* The ICE gathering state of WebRTC peer
8+
* Available since GStreamer 1.14
9+
*/
10+
@Gst.Since(minor = 14)
11+
public enum WebRTCICEGatheringState implements NativeEnum<WebRTCICEGatheringState> {
12+
/** New gathering */
13+
NEW(0),
14+
/** Gathering in progress */
15+
GATHERING(1),
16+
/** Gathering completed */
17+
COMPLETE(2);
18+
19+
private final int value;
20+
21+
private WebRTCICEGatheringState(int value) {
22+
this.value = value;
23+
}
24+
25+
@Override
26+
public int intValue() {
27+
return this.value;
28+
}
29+
}

test/org/freedesktop/gstreamer/WebRTCBinTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.freedesktop.gstreamer;
22

33
import org.freedesktop.gstreamer.glib.NativeEnum;
4+
import org.freedesktop.gstreamer.webrtc.WebRTCICEGatheringState;
45
import org.freedesktop.gstreamer.webrtc.WebRTCPeerConnectionState;
56
import org.junit.Test;
67

@@ -16,4 +17,11 @@ public void connectionStateTest() {
1617
assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 4), WebRTCPeerConnectionState.FAILED);
1718
assertEquals(NativeEnum.fromInt(WebRTCPeerConnectionState.class, 5), WebRTCPeerConnectionState.CLOSED);
1819
}
20+
21+
@Test
22+
public void iceGatheringStateTest() {
23+
assertEquals(NativeEnum.fromInt(WebRTCICEGatheringState.class, 0), WebRTCICEGatheringState.NEW);
24+
assertEquals(NativeEnum.fromInt(WebRTCICEGatheringState.class, 1), WebRTCICEGatheringState.GATHERING);
25+
assertEquals(NativeEnum.fromInt(WebRTCICEGatheringState.class, 2), WebRTCICEGatheringState.COMPLETE);
26+
}
1927
}

0 commit comments

Comments
 (0)