Show stats from both sides

This change shows the stats generated both at the sending PeerConnection
and at the receiving PeerConnection.

BUG=

Review URL: https://webrtc-codereview.appspot.com/1290005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3774 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
hta@webrtc.org 2013-04-06 10:05:55 +00:00
parent 222e9948f5
commit 37bf5847dc

View File

@ -4,6 +4,10 @@
<!-- Load the polyfill to switch-hit between Chrome and Firefox --> <!-- Load the polyfill to switch-hit between Chrome and Firefox -->
<script src="../../base/adapter.js"></script> <script src="../../base/adapter.js"></script>
<style type="text/css">
td { vertical-align: top; }
</style>
<script> <script>
var mystream; var mystream;
var pc1; var pc1;
@ -156,9 +160,23 @@ var statCollector = setInterval(function() {
} }
} }
} }
$('stats').innerHTML = statsString; $('receiverstats').innerHTML = statsString;
display(bitrateText); display(bitrateText);
}); });
pc1.getStats(function(stats) {
var statsString = '';
var results = stats.result();
for (var i = 0; i < results.length; ++i) {
var res = results[i];
statsString += '<h3>Report ';
statsString += i;
statsString += '</h3>';
if (!res.local || res.local === res) {
statsString += dumpStats(res);
}
}
$('senderstats').innerHTML = statsString;
});
} else { } else {
display('No stats function. Use at least Chrome 24.0.1285'); display('No stats function. Use at least Chrome 24.0.1285');
} }
@ -184,7 +202,7 @@ function dumpStats(obj) {
var statsString = 'Timestamp:'; var statsString = 'Timestamp:';
statsString += obj.timestamp; statsString += obj.timestamp;
if (obj.id) { if (obj.id) {
statsString += " id "; statsString += "<br>id ";
statsString += obj.id; statsString += obj.id;
} }
if (obj.type) { if (obj.type) {
@ -284,6 +302,12 @@ Maximum bitrate
<td><pre><span id="addStreamConstraints"></span></pre> <td><pre><span id="addStreamConstraints"></span></pre>
</table> </table>
<h2>Statistics report display</h2> <h2>Statistics report display</h2>
<div id="stats">Stats will appear here.</div> <table>
<tr>
<th>Sender side<th>Receiver side
<tr>
<td align="top"><div id="senderstats">Stats will appear here.</div>
<td align="top"><div id="receiverstats">Stats will appear here.</div>
</table>
</body> </body>
</html> </html>