I am trying to get all information related to mediastreams to get call quality. Peerconnection.getStats() method is deprecated but provides all information as per my requirement like "bytesReceived", "packetsLost", "packetsReceived" ,"googCodecName" and "googJitterBufferMs".
peerConnection.getStats(reports -> {
for (StatsReport report : reports) {
Log.d(TAG, "Stats: " + report.toString());
}
}, null);
Response:
{
values: [
bytesReceived: 951618
],
[
codecImplementationName: OMX.qcom.video.decoder.vp8
],
[
framesDecoded: 171
],
[
mediaType: video
],
[
packetsLost: 4
],
[
packetsReceived: 908
],
[
qpSum: 6409
],
[
ssrc: 3637617127
],
[
transportId: Channel-audio-1
],
[
googCaptureStartNtpTimeMs: 3766113175824
],
[
googCodecName: VP8
],
[
googContentType: realtime
],
[
googCurrentDelayMs: 196
],
[
googDecodeMs: 54
],
[
googFirsSent: 0
],
[
googFirstFrameReceivedToDecodedMs: 225
],
[
googFrameHeightReceived: 720
],
[
googFrameRateDecoded: 22
],
[
googFrameRateOutput: 22
],
[
googFrameRateReceived: 20
],
[
googFrameWidthReceived: 960
],
[
googInterframeDelayMax: 55
],
[
googJitterBufferMs: 116
],
[
googMaxDecodeMs: 70
],
[
googMinPlayoutDelayMs: 91
],
[
googNacksSent: 6
],
[
googPlisSent: 0
],
[
googRenderDelayMs: 10
],
[
googTargetDelayMs: 196
],
[
googTrackId: 100
]
}
Now I can't use this method as its deprecated. When I am trying to use new getStats() method, It does not provides all such information and also the response is also very unorganised.
peerConnection.getStats(new RTCStatsCollectorCallback() {
@Override
public void onStatsDelivered(RTCStatsReport rtcStatsReport) {
Log.d(TAG, "RTCStatsReport: "+rtcStatsReport.getStatsMap().toString());
}
});
Response:-
{
RTCCodec_audio_Inbound_0={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_0,
payloadType: 0,
mimeType: "audio/PCMU",
clockRate: 8000
},
RTCCodec_audio_Inbound_102={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_102,
payloadType: 102,
mimeType: "audio/ILBC",
clockRate: 8000
},
RTCCodec_audio_Inbound_103={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_103,
payloadType: 103,
mimeType: "audio/ISAC",
clockRate: 16000
},
RTCCodec_audio_Inbound_105={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_105,
payloadType: 105,
mimeType: "audio/CN",
clockRate: 16000
},
RTCCodec_audio_Inbound_110={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_110,
payloadType: 110,
mimeType: "audio/telephone-event",
clockRate: 48000
},
RTCCodec_audio_Inbound_111={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_111,
payloadType: 111,
mimeType: "audio/opus",
clockRate: 48000
},
RTCCodec_audio_Inbound_113={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_113,
payloadType: 113,
mimeType: "audio/telephone-event",
clockRate: 16000
},
RTCCodec_audio_Inbound_126={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_126,
payloadType: 126,
mimeType: "audio/telephone-event",
clockRate: 8000
},
RTCCodec_audio_Inbound_13={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_13,
payloadType: 13,
mimeType: "audio/CN",
clockRate: 8000
},
RTCCodec_audio_Inbound_8={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_8,
payloadType: 8,
mimeType: "audio/PCMA",
clockRate: 8000
},
RTCCodec_audio_Inbound_9={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Inbound_9,
payloadType: 9,
mimeType: "audio/G722",
clockRate: 8000
},
RTCCodec_audio_Outbound_0={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Outbound_0,
payloadType: 0,
mimeType: "audio/PCMU",
clockRate: 8000
},
RTCCodec_audio_Outbound_102={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Outbound_102,
payloadType: 102,
mimeType: "audio/ILBC",
clockRate: 8000
},
RTCCodec_audio_Outbound_103={
timestampUs: 1557124386437087,
type: codec,
id: RTCCodec_audio_Outbound_103,
payloadType: 103,
mimeType: "audio/ISAC",
clockRate: 16000
}
}
I am hitting getStats() method after every second and each time it gives me response with different data. This response is not documented anywhere on WebRTC docs.
How I can get "bytesReceived", "packetsLost", "packetsReceived" ,"googCodecName" and "googJitterBufferMs" with new getStats() method.