Closed Bug 2019381 Opened 6 months ago Closed 10 days ago

Handle reception of early media

Categories

(Core :: WebRTC, task, P2)

task

Tracking

()

RESOLVED FIXED
157 Branch
Tracking Status
firefox157 --- fixed

People

(Reporter: bwc, Assigned: dbaker)

References

(Blocks 1 open bug)

Details

Attachments

(7 files)

This is likely to interact with bug 1004510. It is also possible that the spec or test is just broken here.

https://wpt.live/webrtc/rtp-stats-lifetime.https.html?interop-2026

When a transceiver is bundled onto a transport that was already negotiated
by an earlier m-section, that transport's ICE/DTLS is already live, so
packets can arrive before this transceiver's own answer exists. Previously
we would not start receiving (or report inbound-rtp stats) until this
transceiver reached kJsepStateStable, so such early packets were dropped.

Add RTCRtpReceiver::CanTentativelyReceive(), which is true only for a
recvonly/sendrecv transceiver, offered locally, with no real negotiated
details yet, whose transport was inherited from an already-negotiated
bundle owner (JsepTransceiver::mTransport.mIce is only set by
FinalizeTransport() after a real prior negotiation, so this excludes a
transport that has never gone through ICE/DTLS). When true,
UpdateVideoConduit()/UpdateAudioConduit() configure the conduit from the
codecs we offered (via new RTCRtpTransceiver::PrototypeCodecsTo{Audio,
Video}CodecConfigs() helpers, mirroring the existing NegotiatedDetailsTo*
helpers but reading JsepTrack's own offered codecs instead of negotiated
ones), and UpdateConduit() ORs it into mReceiving alongside the existing
IsReceiving() check. currentDirection and getParameters() are untouched,
since those still come from IsReceiving()/GetNegotiatedDetails() alone.

PeerConnectionImpl::OnSetDescriptionSuccess already had a carve-out for
this bundled/local-offer case to prime the MediaPipelineFilter
(UpdateTransport()); this adds the matching UpdateConduit() call so the
conduit itself gets configured, not just the transport-level filter.

Assignee: nobody → dbaker
Status: NEW → ASSIGNED

Extend CanTentativelyReceive() to also apply when a transceiver that
was already negotiated is reoffered (e.g. setting the recv bit,
widening codecs), not just when it's never been negotiated at all.
Gate on having a pending local offer whose own recv-relevant content
actually changed (JsepSession::LocalOfferedRecvParamsChanged()), so an
unrelated, unchanged transceiver elsewhere in the bundle keeps using
its real negotiated details instead of getting reset on every reoffer.

Resolve the bundle group via the new
JsepSession::GetLocalBundleGroupLevels(), checking every member for a
prior negotiated round instead of just the offerer's suggested
transport owner, which JSEP can clear mid-reoffer and which the
answerer isn't required to honor anyway.

Adds test_peerConnection_earlyMediaReoffer.html, covering reoffers that
set the recv bit, add a recv codec, add an RTP extension, add RTX, add
an rtcp-fb type, or add a new bundled m-section.

RTCRtpReceiver::SyncToJsep() already applies the transceiver's
preferred codecs to the recv track via PopulateCodecs(). Do the same
for the send track in RTCRtpSender::SyncToJsep(), so the negotiation
accounting for what we send matches what setCodecPreferences()
actually restricted our own offer/answer to, instead of the full,
unrestricted codec set.

The demux filter used GetNegotiatedDetails(), which is stale during a
pending offer, so a newly-restored extension (e.g. MID) wasn't
recognized until the real answer landed. Read the pending offer's own
extmap instead in that window.

reofferAddsRtpExtension only has one transceiver, so it never proves an
extension is actually used to demux between candidates. Add
reofferRestoresMidDemuxing: 3 bundled recvonly transceivers, no SSRC
information at all, so receiving early media on the right one depends
entirely on the restored MID extension.

GatherIfReady() unconditionally cleared the shared ICE-ctx operation
queue, which could also be holding an already-queued but not-yet-run
StartIceChecks.

Track the gathering request in its own slot so a newer one still
supersedes an older one without discarding unrelated queued
operations.

Pushed by dbaker@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b727d270f576 https://hg.mozilla.org/integration/autoland/rev/ce0f8ab66b9d Support early media reception for bundled recvonly/sendrecv transceivers. r=webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/5695e9492be2 https://hg.mozilla.org/integration/autoland/rev/42950592289c Enhance CanTentativelyReceive() to cover reoffers of already-negotiated transceivers. r=webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/5f091da12bab https://hg.mozilla.org/integration/autoland/rev/73c57cfca8ab Add early media reoffer test coverage. r=webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/9a3820bb8bdc https://hg.mozilla.org/integration/autoland/rev/f8f8b651d820 Propagate setCodecPreferences() to the send track. r=webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/896ddc914b75 https://hg.mozilla.org/integration/autoland/rev/950142e0b1b3 Use the pending offer's RTP extensions when building the early-media demux filter. r=webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/7a2ca5901d20 https://hg.mozilla.org/integration/autoland/rev/46c8bcb47692 Add a MID-only demux test for early media reoffers. r=webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/5ef9b74bf6fb https://hg.mozilla.org/integration/autoland/rev/5d1169150368 Don't let a re-gather discard a pending StartIceChecks. r=webrtc-reviewers,bwc https://github.com/mozilla-firefox/firefox/commit/29a043c67b9d https://hg.mozilla.org/integration/autoland/rev/7bf0964c8119 apply code formatting via Lando
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: