Modified: trunk/LayoutTests/webrtc/video-stats.html (270254 => 270255)
--- trunk/LayoutTests/webrtc/video-stats.html 2020-11-30 19:23:08 UTC (rev 270254)
+++ trunk/LayoutTests/webrtc/video-stats.html 2020-11-30 19:29:20 UTC (rev 270255)
@@ -71,6 +71,20 @@
});
}
+function getRemoteInboundRTPStats(connection)
+{
+ return connection.getStats().then((report) => {
+ checkStatsReportIterator(report);
+ var stats;
+ report.forEach((statItem) => {
+ if (statItem.type === "remote-inbound-rtp") {
+ stats = statItem;
+ }
+ });
+ return stats;
+ });
+}
+
function getOutboundRTPStats(connection)
{
return connection.getStats().then((report) => {
@@ -108,6 +122,7 @@
function checkInboundFramesNumberIncreased(secondConnection, statsSecondConnection, count)
{
return getInboundRTPStats(secondConnection).then((stats) => {
+ assert_true(!!stats.kind);
if (stats.framesDecoded > statsSecondConnection.framesDecoded) {
if (testTimestampDifference(stats.timestamp - statsSecondConnection.timestamp, stats.framesDecoded - statsSecondConnection.framesDecoded))
return Promise.reject("timestamp and frames increment do not match");
@@ -197,11 +212,14 @@
assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "local-candidate", "media-source", "outbound-rtp", "peer-connection", "remote-candidate", "remote-inbound-rtp", "track", "transport"], "second connection");
- const audioSourceStats = await getAudioSourceStats(firstConnection);
- assert_true(!!audioSourceStats, "audio source presence");
+ const audioSourceStats = await getAudioSourceStats(firstConnection);
+ assert_true(!!audioSourceStats, "audio source presence");
- const videoSourceStats = await getVideoSourceStats(firstConnection);
- assert_true(!!videoSourceStats, "video source presence");
+ const videoSourceStats = await getVideoSourceStats(firstConnection);
+ assert_true(!!videoSourceStats, "video source presence");
+
+ const remoteInboundStats = await getRemoteInboundRTPStats(firstConnection);
+ assert_true(remoteInboundStats.kind === "audio"|| remoteInboundStats.kind === "video", "kind is present");
}, "Basic video stats");
promise_test(async (test) => {
@@ -230,6 +248,11 @@
});
assert_false(!!outstats);
assert_true(!!instats);
+
+ assert_greater_than_equal(instats.jitterBufferDelay, 0, "jitterBufferDelay");
+ assert_greater_than_equal(instats.jitterBufferEmittedCount, 0, "jitterBufferEmittedCount");
+ assert_greater_than_equal(instats.concealedSamples, 0, "concealedSamples");
+ assert_greater_than_equal(instats.totalSamplesReceived, 0, "totalSamplesReceived");
}, "Receiver stats");
promise_test(async (test) => {
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp (270254 => 270255)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp 2020-11-30 19:23:08 UTC (rev 270254)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp 2020-11-30 19:29:20 UTC (rev 270255)
@@ -119,7 +119,14 @@
stats.framesDecoded = *rtcStats.frames_decoded;
if (rtcStats.key_frames_decoded.is_defined())
stats.keyFramesDecoded = *rtcStats.key_frames_decoded;
- // frameWidth, frameHeight, frameBitDepth, framesPerSecond
+ if (rtcStats.frame_width.is_defined())
+ stats.frameWidth = *rtcStats.frame_width;
+ if (rtcStats.frame_height.is_defined())
+ stats.frameHeight = *rtcStats.frame_height;
+ if (rtcStats.frame_bit_depth.is_defined())
+ stats.frameBitDepth = *rtcStats.frame_bit_depth;
+ if (rtcStats.frames_per_second.is_defined())
+ stats.framesPerSecond = *rtcStats.frames_per_second;
if (rtcStats.qp_sum.is_defined())
stats.qpSum = *rtcStats.qp_sum;
if (rtcStats.total_decode_time.is_defined())
@@ -128,7 +135,10 @@
stats.totalInterFrameDelay = *rtcStats.total_inter_frame_delay;
if (rtcStats.total_squared_inter_frame_delay.is_defined())
stats.totalSquaredInterFrameDelay = *rtcStats.total_squared_inter_frame_delay;
- // voiceActivityFlag, lastPacketReceivedTimestamp, averageRtcpInterval
+ // voiceActivityFlag
+ if (rtcStats.last_packet_received_timestamp.is_defined())
+ stats.lastPacketReceivedTimestamp = *rtcStats.last_packet_received_timestamp;
+ // averageRtcpInterval
if (rtcStats.header_bytes_received.is_defined())
stats.headerBytesReceived = *rtcStats.header_bytes_received;
if (rtcStats.fec_packets_received.is_defined())
@@ -146,9 +156,33 @@
stats.nackCount = *rtcStats.nack_count;
if (rtcStats.sli_count.is_defined())
stats.sliCount = *rtcStats.sli_count;
- // estimatedPlayoutTimestamp, jitterBufferDelay, jitterBufferEmittedCount, totalSamplesReceived, samplesDecodedWithSilk, samplesDecodedWithCelt
- // concealedSamples, silentConcealedSamples, concealmentEvents, insertedSamplesForDeceleration, removedSamplesForAcceleration
- // audioLevel, totalAudioEnergy, totalSamplesDuration, framesReceived
+ if (rtcStats.estimated_playout_timestamp.is_defined())
+ stats.estimatedPlayoutTimestamp = *rtcStats.estimated_playout_timestamp;
+ if (rtcStats.jitter_buffer_delay.is_defined())
+ stats.jitterBufferDelay = *rtcStats.jitter_buffer_delay;
+ if (rtcStats.jitter_buffer_emitted_count.is_defined())
+ stats.jitterBufferEmittedCount = *rtcStats.jitter_buffer_emitted_count;
+ if (rtcStats.total_samples_received.is_defined())
+ stats.totalSamplesReceived = *rtcStats.total_samples_received;
+ // samplesDecodedWithSilk, samplesDecodedWithCelt
+ if (rtcStats.concealed_samples.is_defined())
+ stats.concealedSamples = *rtcStats.concealed_samples;
+ if (rtcStats.silent_concealed_samples.is_defined())
+ stats.silentConcealedSamples = *rtcStats.silent_concealed_samples;
+ if (rtcStats.concealment_events.is_defined())
+ stats.concealmentEvents = *rtcStats.concealment_events;
+ if (rtcStats.inserted_samples_for_deceleration.is_defined())
+ stats.insertedSamplesForDeceleration = *rtcStats.inserted_samples_for_deceleration;
+ if (rtcStats.removed_samples_for_acceleration.is_defined())
+ stats.removedSamplesForAcceleration = *rtcStats.removed_samples_for_acceleration;
+ if (rtcStats.audio_level.is_defined())
+ stats.audioLevel = *rtcStats.audio_level;
+ if (rtcStats.total_audio_energy.is_defined())
+ stats.totalAudioEnergy = *rtcStats.total_audio_energy;
+ if (rtcStats.total_samples_duration.is_defined())
+ stats.totalSamplesDuration = *rtcStats.total_samples_duration;
+ if (rtcStats.frames_received.is_defined())
+ stats.framesReceived = *rtcStats.frames_received;
if (rtcStats.track_id.is_defined())
stats.trackId = fromStdString(*rtcStats.track_id);
@@ -166,7 +200,7 @@
if (rtcStats.codec_id.is_defined())
stats.codecId = fromStdString(*rtcStats.codec_id);
if (rtcStats.kind.is_defined())
- stats.kind = stats.kind;
+ stats.kind = fromStdString(*rtcStats.kind);
if (rtcStats.local_id.is_defined())
stats.localId = fromStdString(*rtcStats.local_id);
@@ -196,7 +230,8 @@
// senderId
if (rtcStats.remote_id.is_defined())
stats.remoteId = fromStdString(*rtcStats.remote_id);
- // rid, packetsDiscardedOnSend
+ if (rtcStats.rid.is_defined())
+ stats.rid = fromStdString(*rtcStats.rid);
if (rtcStats.header_bytes_sent.is_defined())
stats.headerBytesSent = *rtcStats.header_bytes_sent;
// packetsDiscardedOnSend, bytesDiscardedOnSend, fecPacketsSent;
@@ -206,7 +241,19 @@
stats.retransmittedBytesSent = *rtcStats.retransmitted_bytes_sent;
if (rtcStats.target_bitrate.is_defined())
stats.targetBitrate = *rtcStats.target_bitrate;
- // totalEncodedBytesTarget, frameWidth, frameHeight, frameBitDepth, framesPerSecond, framesSent, hugeFramesSent
+ if (rtcStats.total_encoded_bytes_target.is_defined())
+ stats.totalEncodedBytesTarget = *rtcStats.total_encoded_bytes_target;
+ if (rtcStats.frame_width.is_defined())
+ stats.frameWidth = *rtcStats.frame_width;
+ if (rtcStats.frame_height.is_defined())
+ stats.frameHeight = *rtcStats.frame_height;
+ // frameBitDepth
+ if (rtcStats.frames_per_second.is_defined())
+ stats.framesPerSecond = *rtcStats.frames_per_second;
+ if (rtcStats.frames_sent.is_defined())
+ stats.framesSent = *rtcStats.frames_sent;
+ if (rtcStats.huge_frames_sent.is_defined())
+ stats.hugeFramesSent = *rtcStats.huge_frames_sent;
if (rtcStats.frames_encoded.is_defined())
stats.framesEncoded = *rtcStats.frames_encoded;
if (rtcStats.key_frames_encoded.is_defined())
@@ -214,11 +261,14 @@
// framesDiscardedOnSend;
if (rtcStats.qp_sum.is_defined())
stats.qpSum = *rtcStats.qp_sum;
- // totalEncodedBytesTarget, frameWidth, frameHeight, frameBitDepth, framesPerSecond, framesSent, hugeFramesSent
- // totalSamplesSent, samplesEncodedWithSilk, samplesEncodedWithCelt, voiceActivityFlag, totalEncodeTime
+ // totalSamplesSent, samplesEncodedWithSilk, samplesEncodedWithCelt, voiceActivityFlag
+ if (rtcStats.total_encode_time.is_defined())
+ stats.totalEncodeTime = *rtcStats.total_encode_time;
if (rtcStats.total_packet_send_delay.is_defined())
stats.totalPacketSendDelay = *rtcStats.total_packet_send_delay;
- // averageRtcpInterval, qualityLimitationResolutionChanges
+ // averageRtcpInterval
+ if (rtcStats.quality_limitation_resolution_changes.is_defined())
+ stats.qualityLimitationResolutionChanges = *rtcStats.quality_limitation_resolution_changes;
if (rtcStats.nack_count.is_defined())
stats.nackCount = *rtcStats.nack_count;
if (rtcStats.fir_count.is_defined())