@@ -495,6 +495,12 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) {
495
495
createDataChannel (peerConnectionId , label , new ConstraintsMap (dataChannelDict ), result );
496
496
break ;
497
497
}
498
+ case "dataChannelGetBufferedAmount" : {
499
+ String peerConnectionId = call .argument ("peerConnectionId" );
500
+ String dataChannelId = call .argument ("dataChannelId" );
501
+ dataChannelGetBufferedAmount (peerConnectionId , dataChannelId , result );
502
+ break ;
503
+ }
498
504
case "dataChannelSend" : {
499
505
String peerConnectionId = call .argument ("peerConnectionId" );
500
506
String dataChannelId = call .argument ("dataChannelId" );
@@ -2062,6 +2068,17 @@ public void dataChannelSend(String peerConnectionId, String dataChannelId, ByteB
2062
2068
}
2063
2069
}
2064
2070
2071
+ public void dataChannelGetBufferedAmount (String peerConnectionId , String dataChannelId , Result result ) {
2072
+ PeerConnectionObserver pco
2073
+ = mPeerConnectionObservers .get (peerConnectionId );
2074
+ if (pco == null || pco .getPeerConnection () == null ) {
2075
+ Log .d (TAG , "dataChannelGetBufferedAmount() peerConnection is null" );
2076
+ resultError ("dataChannelGetBufferedAmount" , "peerConnection is null" , result );
2077
+ } else {
2078
+ pco .dataChannelGetBufferedAmount (dataChannelId , result );
2079
+ }
2080
+ }
2081
+
2065
2082
public void dataChannelClose (String peerConnectionId , String dataChannelId ) {
2066
2083
// Forward to PeerConnectionObserver which deals with DataChannels
2067
2084
// because DataChannel is owned by PeerConnection.
0 commit comments