@@ -495,6 +495,12 @@ public void onMethodCall(MethodCall call, @NonNull Result notSafeResult) {
495495 createDataChannel (peerConnectionId , label , new ConstraintsMap (dataChannelDict ), result );
496496 break ;
497497 }
498+ case "dataChannelGetBufferedAmount" : {
499+ String peerConnectionId = call .argument ("peerConnectionId" );
500+ String dataChannelId = call .argument ("dataChannelId" );
501+ dataChannelGetBufferedAmount (peerConnectionId , dataChannelId , result );
502+ break ;
503+ }
498504 case "dataChannelSend" : {
499505 String peerConnectionId = call .argument ("peerConnectionId" );
500506 String dataChannelId = call .argument ("dataChannelId" );
@@ -2062,6 +2068,17 @@ public void dataChannelSend(String peerConnectionId, String dataChannelId, ByteB
20622068 }
20632069 }
20642070
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+
20652082 public void dataChannelClose (String peerConnectionId , String dataChannelId ) {
20662083 // Forward to PeerConnectionObserver which deals with DataChannels
20672084 // because DataChannel is owned by PeerConnection.
0 commit comments