Closed Bug 1452673 Opened 2 years ago Closed 2 years ago

RTCRtpSender.getStats() returns too much data when sender.track is null

Categories

(Core :: WebRTC, defect, P2)

55 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: fippo, Assigned: ng)

Details

Attachments

(1 file)

from https://github.com/webrtc/adapter/pull/809 and resulting discussion...

steps to reproduce:
1) go to https://webrtc.github.io/samples/src/content/peerconnection/pc1/
2) make a call
3) run this in the JS console: var sender = pc2.getSenders()[0]
4) inspect sender.track -- should be null
5) call sender.getStats().then(stats => console.log(stats))

This should return an empty Map (probably). Currently it seems to be implemented as pc.getStats(sender.track) which is essentially calling pc.getStats() without a selector.
Not a regression.
Rank: 19
OS: Unspecified → All
Priority: -- → P2
Hardware: Unspecified → All
Version: 59 Branch → 55 Branch
note: empty Map should only be returned if there was never a track. If there was a track and it was null'ed via replaceTrack there should be stats for that track.
Attachment #8968807 - Flags: review?(mfroman)
Comment on attachment 8968807 [details]
Bug 1452673 - trackless RTCRtpSender.getStats() returning unfiltered results

https://reviewboard.mozilla.org/r/237532/#review243382

::: dom/media/tests/mochitest/test_peerConnection_trackless_sender_stats.html:33
(Diff revision 1)
> +            let senders = test.pcLocal.getSenders();
> +            let receivers = test.pcRemote.getReceivers();
> +            is(senders.length, 2, "Have exactly two senders.");
> +            is(receivers.length, 2, "Have exactly two receivers.");
> +            for(let kind of ["audio", "video"]) {
> +              let senderStats =

senderStats isn't used.

::: dom/media/tests/mochitest/test_peerConnection_trackless_sender_stats.html:37
(Diff revision 1)
> +            for(let kind of ["audio", "video"]) {
> +              let senderStats =
> +                  await senders.find(s => s.track.kind == kind).getStats();
> +              is(senders.filter(s => s.track.kind == kind).length, 1,
> +                  "Exactly 1 sender of kind " + kind);
> +              let receiverStats =

receiverStats isn't used.
Attachment #8968807 - Flags: review?(mfroman) → review+
Comment on attachment 8968807 [details]
Bug 1452673 - trackless RTCRtpSender.getStats() returning unfiltered results

https://reviewboard.mozilla.org/r/237532/#review243470

Looks good!
Pushed by na-g@nostrum.com:
https://hg.mozilla.org/integration/autoland/rev/25adabc13a5b
trackless RTCRtpSender.getStats() returning unfiltered results r=mjf
https://hg.mozilla.org/mozilla-central/rev/25adabc13a5b
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.