Skip to content

Commit 22eaad3

Browse files
youennfphiln
authored andcommitted
Add support for inbound rtp trackIdentifier stat field
https://bugs.webkit.org/show_bug.cgi?id=250450 rdar://problem/104118773 Expose trackIdentifier and remove receiverId. This is needed as track stats might be removed in the future. Reviewed by Eric Carlson. * LayoutTests/webrtc/video-stats.html: * Source/WebCore/Modules/mediastream/RTCStatsReport.h: * Source/WebCore/Modules/mediastream/RTCStatsReport.idl: * Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp: (WebCore::fillInboundRtpStreamStats): Canonical link: https://commits.webkit.org/258835@main
1 parent 1ac20ec commit 22eaad3

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

LayoutTests/webrtc/video-stats.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@
122122
function checkInboundFramesNumberIncreased(secondConnection, statsSecondConnection, count)
123123
{
124124
return getInboundRTPStats(secondConnection).then((stats) => {
125-
assert_true("framesDropped" in stats);
126-
assert_true(!!stats.kind);
125+
assert_true("framesDropped" in stats, "framesDropped");
126+
assert_true(!!stats.trackIdentifier, "trackIdentifier");
127+
assert_true(!!stats.kind, "kind");
127128
if (stats.framesDecoded > statsSecondConnection.framesDecoded) {
128129
if (testTimestampDifference(stats.timestamp - statsSecondConnection.timestamp, stats.framesDecoded - statsSecondConnection.framesDecoded))
129130
return Promise.reject("timestamp and frames increment do not match");

Source/WebCore/Modules/mediastream/RTCStatsReport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class RTCStatsReport : public RefCounted<RTCStatsReport> {
8989
struct InboundRtpStreamStats : ReceivedRtpStreamStats {
9090
InboundRtpStreamStats() { type = RTCStatsReport::Type::InboundRtp; }
9191

92-
String receiverId;
92+
String trackIdentifier;
9393
String remoteId;
9494
std::optional<uint32_t> framesDecoded;
9595
std::optional<uint32_t> keyFramesDecoded;

Source/WebCore/Modules/mediastream/RTCStatsReport.idl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ dictionary RTCReceivedRtpStreamStats : RTCRtpStreamStats {
8888

8989
[ JSGenerateToJSObject ]
9090
dictionary RTCInboundRtpStreamStats : RTCReceivedRtpStreamStats {
91-
// required DOMString receiverId;
92-
DOMString remoteId;
91+
required DOMString trackIdentifier;
9392
unsigned long framesDecoded;
9493
unsigned long keyFramesDecoded;
9594
unsigned long frameWidth;

Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ static inline void fillInboundRtpStreamStats(RTCStatsReport::InboundRtpStreamSta
9191
{
9292
fillReceivedRtpStreamStats(stats, rtcStats);
9393

94-
// receiverId
95-
// remoteId
94+
if (rtcStats.track_identifier.is_defined())
95+
stats.trackIdentifier = fromStdString(*rtcStats.track_identifier);
96+
if (rtcStats.remote_id.is_defined())
97+
stats.remoteId = fromStdString(*rtcStats.remote_id);
98+
9699
if (rtcStats.packets_received.is_defined())
97100
stats.packetsReceived = *rtcStats.packets_received;
98101
if (rtcStats.frames_dropped.is_defined())

0 commit comments

Comments
 (0)