diff --git a/jni/libdatachannel b/jni/libdatachannel index 0b15881..1fe8a38 160000 --- a/jni/libdatachannel +++ b/jni/libdatachannel @@ -1 +1 @@ -Subproject commit 0b158812cfbd9676e7cf4a63452e0e13f305997e +Subproject commit 1fe8a3886661d8a87036a1e90098dc765d201c7d diff --git a/jni/src/native_peer.cpp b/jni/src/native_peer.cpp index aff5e96..1e106c6 100644 --- a/jni/src/native_peer.cpp +++ b/jni/src/native_peer.cpp @@ -370,7 +370,9 @@ JNIEXPORT jobject JNICALL Java_tel_schich_libdatachannel_LibDataChannelNative_rt static_cast(stats.congestionWindow), static_cast(stats.peerReceiveWindow), static_cast(stats.unackedChunks), static_cast(stats.pendingChunks), static_cast(stats.dataTimeouts), static_cast(stats.sendQueueBytes), - static_cast(stats.sendBufferSize), static_cast(stats.receiveQueueBytes)); + static_cast(stats.sendBufferSize), static_cast(stats.receiveQueueBytes), + static_cast(stats.fastRetransmits), static_cast(stats.retransmittedChunks), + static_cast(stats.gapSacks), static_cast(stats.duplicateTsnsReceived)); } JNIEXPORT jint JNICALL Java_tel_schich_libdatachannel_LibDataChannelNative_rtcSetLocalDescriptionWithIce( diff --git a/src/main/java/tel/schich/libdatachannel/SctpStats.java b/src/main/java/tel/schich/libdatachannel/SctpStats.java index 920609e..7d35d09 100644 --- a/src/main/java/tel/schich/libdatachannel/SctpStats.java +++ b/src/main/java/tel/schich/libdatachannel/SctpStats.java @@ -8,11 +8,13 @@ public final class SctpStats { private final Duration rtt, rto; private final long congestionWindow, peerReceiveWindow, unackedChunks, pendingChunks, dataTimeouts, - sendQueueBytes, sendBufferSize, receiveQueueBytes; + sendQueueBytes, sendBufferSize, receiveQueueBytes, fastRetransmits, retransmittedChunks, gapSacks, + duplicateTsnsReceived; private SctpStats(Duration rtt, Duration rto, long congestionWindow, long peerReceiveWindow, long unackedChunks, long pendingChunks, long dataTimeouts, long sendQueueBytes, - long sendBufferSize, long receiveQueueBytes) { + long sendBufferSize, long receiveQueueBytes, long fastRetransmits, + long retransmittedChunks, long gapSacks, long duplicateTsnsReceived) { this.rtt = rtt; this.rto = rto; this.congestionWindow = congestionWindow; @@ -23,15 +25,20 @@ private SctpStats(Duration rtt, Duration rto, long congestionWindow, long peerRe this.sendQueueBytes = sendQueueBytes; this.sendBufferSize = sendBufferSize; this.receiveQueueBytes = receiveQueueBytes; + this.fastRetransmits = fastRetransmits; + this.retransmittedChunks = retransmittedChunks; + this.gapSacks = gapSacks; + this.duplicateTsnsReceived = duplicateTsnsReceived; } @JNIAccess static SctpStats create(int rttMillis, int rtoMillis, long congestionWindow, long peerReceiveWindow, long unackedChunks, long pendingChunks, long dataTimeouts, long sendQueueBytes, - long sendBufferSize, long receiveQueueBytes) { + long sendBufferSize, long receiveQueueBytes, long fastRetransmits, + long retransmittedChunks, long gapSacks, long duplicateTsnsReceived) { return new SctpStats(Duration.ofMillis(rttMillis), Duration.ofMillis(rtoMillis), congestionWindow, peerReceiveWindow, unackedChunks, pendingChunks, dataTimeouts, sendQueueBytes, sendBufferSize, - receiveQueueBytes); + receiveQueueBytes, fastRetransmits, retransmittedChunks, gapSacks, duplicateTsnsReceived); } /** Smoothed round trip time in whole milliseconds, zero until sampled or while under one. */ @@ -54,12 +61,25 @@ static SctpStats create(int rttMillis, int rtoMillis, long congestionWindow, lon public long sendBufferSize() { return sendBufferSize; } /** Received bytes waiting for reassembly or ordering. */ public long receiveQueueBytes() { return receiveQueueBytes; } + /** + * Packets sent by fast retransmit, after the peer reported gaps. Each halves the congestion window, so where + * these run ahead of what the path lost, the peer is reporting gaps for data that arrived. + */ + public long fastRetransmits() { return fastRetransmits; } + /** DATA chunks sent again, by fast retransmit or after a retransmission timeout. */ + public long retransmittedChunks() { return retransmittedChunks; } + /** SACKs received that reported gaps in what the peer had. */ + public long gapSacks() { return gapSacks; } + /** DATA chunks received that had arrived already, so the peer resent what it need not have. */ + public long duplicateTsnsReceived() { return duplicateTsnsReceived; } @Override public String toString() { return "SctpStats{rtt=" + rtt.toMillis() + "ms, rto=" + rto.toMillis() + "ms, congestionWindow=" + congestionWindow + ", peerReceiveWindow=" + peerReceiveWindow + ", unackedChunks=" + unackedChunks + ", pendingChunks=" + pendingChunks + ", dataTimeouts=" + dataTimeouts + ", sendQueueBytes=" + - sendQueueBytes + ", sendBufferSize=" + sendBufferSize + ", receiveQueueBytes=" + receiveQueueBytes + "}"; + sendQueueBytes + ", sendBufferSize=" + sendBufferSize + ", receiveQueueBytes=" + receiveQueueBytes + + ", fastRetransmits=" + fastRetransmits + ", retransmittedChunks=" + retransmittedChunks + ", gapSacks=" + + gapSacks + ", duplicateTsnsReceived=" + duplicateTsnsReceived + "}"; } }