@@ -482,6 +482,12 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) {
482
482
createDataChannel (peerConnectionId , label , new ConstraintsMap (dataChannelDict ), result );
483
483
break ;
484
484
}
485
+ case "dataChannelGetBufferedAmount" : {
486
+ String peerConnectionId = call .argument ("peerConnectionId" );
487
+ String dataChannelId = call .argument ("dataChannelId" );
488
+ dataChannelGetBufferedAmount (peerConnectionId , dataChannelId , result );
489
+ break ;
490
+ }
485
491
case "dataChannelSend" : {
486
492
String peerConnectionId = call .argument ("peerConnectionId" );
487
493
String dataChannelId = call .argument ("dataChannelId" );
@@ -2039,6 +2045,17 @@ public void dataChannelSend(String peerConnectionId, String dataChannelId, ByteB
2039
2045
}
2040
2046
}
2041
2047
2048
+ public void dataChannelGetBufferedAmount (String peerConnectionId , String dataChannelId , Result result ) {
2049
+ PeerConnectionObserver pco
2050
+ = mPeerConnectionObservers .get (peerConnectionId );
2051
+ if (pco == null || pco .getPeerConnection () == null ) {
2052
+ Log .d (TAG , "dataChannelGetBufferedAmount() peerConnection is null" );
2053
+ resultError ("dataChannelGetBufferedAmount" , "peerConnection is null" , result );
2054
+ } else {
2055
+ pco .dataChannelGetBufferedAmount (dataChannelId , result );
2056
+ }
2057
+ }
2058
+
2042
2059
public void dataChannelClose (String peerConnectionId , String dataChannelId ) {
2043
2060
// Forward to PeerConnectionObserver which deals with DataChannels
2044
2061
// because DataChannel is owned by PeerConnection.
0 commit comments