WebRTC stats Bug - inside a callback function
Reported by
giuliota...@gmail.com,
Aug 22 2016
|
||||
Issue descriptionChrome Version : 52.0.2743.116 (Official Build) (64-bit) URLs (if applicable) : https://webrtc.github.io/samples/src/content/peerconnection/pc1/ The function inside a peerConnection (in the example below is "pc1") that gives stats about the webRTC call seems to not work normally. It is impossible to have stats inside a callback function. What steps will reproduce the problem? (1) Go to this link https://webrtc.github.io/samples/src/content/peerconnection/pc1/ and start a call. (1) Open the console. (2) Declare these variables: "let RTCStatsReports, elem;". (3) Run this code pc1.getStats(res => { RTCStatsReports = res.result(); for (elem of RTCStatsReports) { if (elem.id === 'bweforvideo') { console.log('found the right element'); elem.stat("googActualEncBitrate", function(res){ console.log('Result A: ', res); //This line is never printed }); break; } } }); And I never see the result of "console.log('Result A: ', res);" (4) But if I run this code the result is printed elem.stat("googActualEncBitrate", function(res){ console.log('Result B: ', res); //This line is never printed }); What is the expected result? Some value from the chrome://webrtc-internals/ stats like "300000". What happens instead? The callback inside "elem.stat" is never fired.
,
Aug 24 2016
Tested the same on mac 10.11.6 chrome version 52.0.2743.116 and canary - None of the results A or B is displayed instead an error is displayed as shown in the screenshot. Could you please let us know if i am missing something in reproducing the issue.
,
Aug 24 2016
I think you forgot to press the "call" button, before pasting the code. N.B. You have to press 1 - Start button 2 - Call button 3 - Paste the code
,
Aug 31 2016
Thank you for providing more feedback. Adding requester "tkonchada@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Sep 1 2016
giuliotani29@ where have you gotten information on that RTCStatsReport.stat() method should accept a 2nd parameter?
Just request the stat directly:
pc1.getStats(res => {
RTCStatsReports = res.result();
for (elem of RTCStatsReports) {
if (elem.id === 'bweforvideo') {
console.log('found the right element');
console.log(elem.stat("googActualEncBitrate"))
break;
}
}
});
,
Sep 2 2016
jansson@ thanks you! I found an example on the web were RTCStatsReport.stat() takes a 2nd parameter. I was not able to find an official documentation. Do you know if there is an official documentation? |
||||
►
Sign in to add a comment |
||||
Comment 1 by shivanisha@chromium.org
, Aug 23 2016