Re: getStats on closed peerConnection

On 08/20/2014 11:03 PM, Jan-Ivar Bruaroey wrote:
> I'd like to propose a change to getStats so that calling it on a 
> closed PeerConnection does not throw, but instead gives you the stats 
> at the time the PeerConnection closed.

Chrome has worked that way forever, exactly for that reason.

I'm filing this as a bug [bug 26620]. Thanks for catching it!


>
> Use-case: A webpage wants stats about the call that just terminated 
> from the other side - e.g. how many frames dropped?
>
> In [1] remove step 1:
>>     1. If the ||RTCPeerConnection| 
>> <http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection>| 
>> object's |RTCPeerConnection| signalingState 
>> <http://dev.w3.org/2011/webrtc/editor/webrtc.html#dom-peerconnection-signaling-state> 
>> is |closed|, throw an |InvalidStateError| exception. 
>
> And edit step 5 (which would now be 4):
>
>>     4. Start gathering the stats indicated by selectorArg. In case 
>> selectorArg is null, stats /MUST/ be gathered for the whole 
>> ||RTCPeerConnection| 
>> <http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection>| 
>> object. If the ||RTCPeerConnection| 
>> <http://dev.w3.org/2011/webrtc/editor/webrtc.html#idl-def-RTCPeerConnection>| 
>> object's |RTCPeerConnection| signalingState 
>> <http://dev.w3.org/2011/webrtc/editor/webrtc.html#dom-peerconnection-signaling-state> 
>> is |closed|, stats should reflect the state at or near the time that 
>> signalingState 
>> <http://dev.w3.org/2011/webrtc/editor/webrtc.html#dom-peerconnection-signaling-state> 
>> transitioned to |closed|.
>
> Implementations would basically cache a final call to getStats 
> internally as part of transitioning to closed.
>
> .: Jan-Ivar :.
>
> [1] http://dev.w3.org/2011/webrtc/editor/webrtc.html#methods-5
>

Received on Wednesday, 20 August 2014 21:37:57 UTC