Commit Graph

5 Commits

Author SHA1 Message Date
Sean DuBois
82ad5e6b5f Refactor TestTrackDetailsFromSDP
Move asserts that direction is taken into account when ssrc is found
into distinct test.
2020-04-21 01:25:32 -07:00
Jerko Steiner
eb2cdd6be0 Filter out non-sending incoming tracks
This modification will only keep incoming tracks from media sections
with `a=sendrecv` or `a=sendonly` attributes. This modification is not
necessary for pion-to-pion peer connections, but for browser-to-pion
connections using Unified Plan.

Background:

When a `RTCPeerConnection#removeTrack()` is called in the browser and
the connection is renegotiated, the browser (tested in Firefox 75.0)
will change the media section attribute to `a=recvonly` from
`a=sendrecv`, or `a=inactive` from `a=sendonly`, but will keep the same
`a=ssrc:<ssrc>` associated with the same media (mid) section.

Previously, when a remote track obtained with Pion's `OnTrack()` handler
was being read from, and this remote track was later removed in the
browser, the track's `Read()` method would never return `io.EOF` (unless
the peer connection was closed).

With this commit, the `trackDetailsFromSDP` function will only include
remote track details whose media section has `a=sendonly` or
`a=sendrecv` attributes, and previously existing logic will ensure that
a receiver for that specific ssrc is stopped, so that
`webrtc.Track#Read()` method returns `io.EOF`.
2020-04-21 01:25:32 -07:00
Jerko Steiner
729613095d Read "a=msid:<track_id> <track_label>"
This format is used in SDP answers by Unified plan in Firefox and
Chrome.
2020-04-14 08:42:00 +02:00
Simon Eisenmann
d41ef0b6b4 Ignore rtx ssrc FID group when extracting tracks
If the remote description contains rtx information via a `ssrc-group`,
the extra `ssrc` entries must be ignored to ensure thats no receiver
is added for them.

This can solve issues like `Incoming unhandled RTP ssrc(1858531374)` if
those are caused by a wrong receiver getting started for the rtx ssrc
but not for the track ssrc, based on the ssrc/transceiver oder in the
remote description.

Until rtx is properly supported, this change fixes the imediate issue
that some remote streams are randomly not received because of a remotes
rtx information.

Fixes: #1081
Related: #1083
2020-03-22 00:48:30 -07:00
Sean DuBois
00ba9ab52e Split ICE and DTLS related SDP parsing out
Move this stuff out of SetRemoteDescription so it will be easier to test

Relates to #1023
2020-02-14 18:53:19 -08:00