Skip to content

Commit

Permalink
[Node] Bring transport rtpPacketLossReceived and `rtpPacketLossSent…
Browse files Browse the repository at this point in the history
…` stats back

They were removed somehow during flatbufferts migration.

BTW those stats are cusotm ones that consist on a number (from 0 to 1) indicating the current "quality" of the RTP transmission based on packet loss / total packets.
  • Loading branch information
ibc committed Apr 9, 2024
1 parent c0e3a62 commit ae6984d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### NEXT

- Node: Bring transport `rtpPacketLossReceived` and `rtpPacketLossSent` stats back ([PR #XXXX](https://github.com/versatica/mediasoup/pull/XXXX)).

### 3.14.0

- `TransportListenInfo`: Add `portRange` (deprecate worker port range) ([PR #1365](https://github.com/versatica/mediasoup/pull/1365)).
Expand Down
12 changes: 12 additions & 0 deletions node/src/Transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ export type BaseTransportStats = {
availableOutgoingBitrate?: number;
availableIncomingBitrate?: number;
maxIncomingBitrate?: number;
maxOutgoingBitrate?: number;
minOutgoingBitrate?: number;
rtpPacketLossReceived: number;
rtpPacketLossSent: number;
};

type TransportData =
Expand Down Expand Up @@ -1480,6 +1484,14 @@ export function parseBaseTransportStats(
maxIncomingBitrate: binary.maxIncomingBitrate()
? Number(binary.maxIncomingBitrate())
: undefined,
maxOutgoingBitrate: binary.maxOutgoingBitrate()
? Number(binary.maxOutgoingBitrate())
: undefined,
minOutgoingBitrate: binary.minOutgoingBitrate()
? Number(binary.minOutgoingBitrate())
: undefined,
rtpPacketLossReceived: Number(binary.rtpPacketLossReceived()),
rtpPacketLossSent: Number(binary.rtpPacketLossSent()),
};
}

Expand Down
4 changes: 2 additions & 2 deletions worker/src/RTC/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,10 @@ namespace RTC
// minOutgoingBitrate.
this->minOutgoingBitrate ? flatbuffers::Optional<uint32_t>(this->minOutgoingBitrate)
: flatbuffers::nullopt,
// packetLossReceived.
// rtpPacketLossReceived.
this->tccServer ? flatbuffers::Optional<double>(this->tccServer->GetPacketLoss())
: flatbuffers::nullopt,
// packetLossSent.
// rtpPacketLossSent.
this->tccClient ? flatbuffers::Optional<double>(this->tccClient->GetPacketLoss())
: flatbuffers::nullopt);
}
Expand Down

0 comments on commit ae6984d

Please sign in to comment.