Open Bug 1056433 Opened 11 years ago Updated 19 hours ago

getStats should be allowed on a closed PeerConnection

Categories

(Core :: WebRTC, defect, P3)

defect

Tracking

()

ASSIGNED

People

(Reporter: jib, Assigned: philipp.hancke, NeedInfo)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Change getStats so that calling it on a closed PeerConnection does not throw, but instead makes available the stats at the time the PeerConnection closed. Use-case: A webpage wants stats about the call that just terminated from the other side - e.g. how many frames dropped? Basically we already cache a final call to getStats internally for about:webrtc, so this bug is about returning this to content when getStats is called after close.
Rank: 35
Priority: -- → P3
backlog: --- → webRTC+
Mass change P3->P4 to align with new Mozilla triage process.
Priority: P3 → P4
We already take a snapshot of stats at time of close internally, for about:webrtc so this could be low-hanging fruit.
Rank: 35 → 19
Priority: P4 → P2
Steps to reproduce: 1. Open https://jsfiddle.net/jib1/wmae5jtn/ and allow access 2. Click "Close!" button Expected results: - Stats numbers should stop increasing, and fps which should go to 0. Actual result: - TypeError: stats is null

Here's some newer STRs for this bug that don't require interaction:

  1. Open https://jsfiddle.net/jib1/6rzL3asv/18/

Expected result (Chrome):

checking
connected
[object Object]
[object Object]
disconnected
failed

Actual result (Firefox):

checking
connected
[object Object]
undefined
disconnected
failed

Spec support on preserving stats after transceiver.stop() and pc.close():

"With a few exceptions, monitored objects, once created, exist for the duration of their associated RTCPeerConnection. This ensures statistics from them are available in the result from getStats() even past the associated peer connection being closed.

Only a few monitored objects have shorter lifetimes. Statistics from these objects are no longer available in subsequent getStats() results. The object descriptions in [WEBRTC-STATS] describe when these monitored objects are deleted. "

And

"RTP monitored objects are not deleted."

Severity: normal → S3
Priority: P2 → P3
Blocks: 2029377

Is there an ETA? I got a request to polyfill this in adapter.js but adding polyfills without an exit criterion is more harm than good:
https://github.com/webrtcHacks/adapter/issues/1179

Note: this retains local and remote candidate stats which Chromium does not
and which might violate the specification.

Attachment #9568709 - Attachment description: WIP: Bug 1056433: do not throw when calling getStats on a closed peerconnection → Bug 1056433: do not throw when calling getStats on a closed peerconnection
Assignee: nobody → philipp.hancke
Status: NEW → ASSIGNED
Pushed by bcampen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4c0a122007df https://hg.mozilla.org/integration/autoland/rev/e05d4e4c4ceb do not throw when calling getStats on a closed peerconnection r=webrtc-reviewers,bwc
Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e9328fdda48d https://hg.mozilla.org/integration/autoland/rev/5386cca723f6 Revert "Bug 1056433: do not throw when calling getStats on a closed peerconnection r=webrtc-reviewers,bwc" for causing mda failures at getStats peer connection

Backed out for causing mda failures at getStats peer connection
Backout Link
Push with failures
Failure Log
Failure line TEST-UNEXPECTED-FAIL | dom/media/webrtc/tests/mochitests/test_peerConnection_bug1773067.html | getStats on closed peer connection fails instead of hanging - got undefined, expected "InvalidStateError"

Flags: needinfo?(philipp.hancke)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: