Commit Graph

38 Commits

Author SHA1 Message Date
Joe Turki
740e5166c5 Update lint rules, force testify/assert for tests
Use testify's assert package instead of the standard library's testing
package.
2025-03-27 12:08:37 +02:00
Sean DuBois
e4ff415b2b Support DataChannel messages larger then MaxUint16
SCTP now internally can handle larger messages

Resolves #2712
2025-03-04 18:22:14 -08:00
Manish
19789447bb Return error if payload type exists in codecs list 2025-03-01 22:02:48 +02:00
Joe Turki
feeeebf251 Upgrade golangci-lint, more linters
Introduces new linters, upgrade golangci-lint to version (v1.63.4)
2025-01-18 07:16:06 -06:00
Joe Turk
5edce958fd Include sdpMid and sdpMLineIndex for ICECandidates returned by OneICECandidate (#2990)
#### Description
Currently, Pion returns an empty `sdpMid` and a 0 `sdpMLineIndex`. This
PR ensures Pion returns the corresponding `sdpMid` and `sdpMLineIndex`
for ICE candidates for clients that expects it. Fixes trickle issues.

#### Changes

1. `ICECandidates`: New fields `SDPMid` and `SDPMLineIndex`.
2. `ICEGatherer`: `SetMediaStreamIdentification` and return the correct
`SDPMid` and `SDPMLineIndex`.
3. `extractICEDetails`: Return a struct instead of multiple values.
4. `extractICEDetails` refactored the media description selection to a
different function.
5. Added new tests.

#### Reference issue
Fixes https://github.com/pion/webrtc/issues/2690
Fixes https://github.com/pion/webrtc/issues/1833
2025-01-08 19:08:44 -06:00
Nils Ohlmeier
2fd3640fa3 Only collect single fingerprints/ICE credentials
The way currently DTLS fingerprints and ICE credentials
are picked is causing interop issues as described in #2621

Peers which don't use Bundle can use different fingerprints
and credentials in each media section. Even though is
not (yet) supported by Pion, receiving an SDP offer from
such a peer is valid.

Additionally if Bundle is being used the group attribute
determines which media section is the master bundle section,
which establishes the transport. Currently Pion always
just uses the first credentials/fingerprint it can find
in the SDP, which results in not spec compliant behavior.

This PR attempts to fix the above issues and make
Pion more spec compliant and interoperable.

Fixes #2621
2024-11-13 23:44:00 -05:00
Sean DuBois
4541b73b1a Add Retransmission and FEC to TrackLocal
If the MediaEngine contains support for them a SSRC will be generated
appropriately

Co-authored-by: aggresss <aggresss@163.com>
Co-authored-by: Kevin Wang <kevmo314@gmail.com>

Resolves #1989
Resolves #1675
2024-10-03 20:44:49 -07:00
Juan Navarro
cbbb1c29e5 Fix disordered RIDs in SDP
Map iteration order is not guaranteed by Go, so it's an error to iterate
over a map in places where maintaining the same ordering is important.

This change replaces the map of simulcastRid{} with an array of the same
type. The simulcastRid{} type is extended to hold the rid-id which
previously was used as the key in the map.

Accesses to the map are replaced with range loops to find the desired
rid-id for each case.

Fixes #2838
2024-08-01 10:56:45 -04:00
Sean DuBois
88d8eef8ae Add test for ssrc-group after ssrc
Resolves #2459
2024-04-03 23:41:37 -04:00
Sean DuBois
ea29c92b9b Update github.com/pion/sdp/v3 to v3.0.9 2024-03-28 21:59:00 -04:00
cnderrauber
ee9717e95b Answer to paused simucalst stream correctly
Answer to paused simucalst stream correctly
2023-12-12 15:10:12 +08:00
cnderrauber
2225386c41 Generate answer to match group bundle in offer
Generate answer to match group bundle in offer
2023-09-08 09:30:52 -07:00
Steffen Vogel
683fc837d0 Make repo REUSE compliant 2023-05-05 11:58:49 -04:00
cnderrauber
0c8ce8e15c Set extmap-allow-mixed by default
For support with dependency descriptor, chrome will use
mixed extmap both one-byte and two-byte defined in RFC8285,
add the attribute to support that
2022-05-12 12:19:25 +08:00
Aaron Boushley
aa050eaa2f Resolve issue with rejecting tracks from Firefox
When running the reflect example against Firefox 99.0.1 I was receiving
errors around parsing the SDP from Pion.

The error was:

  SIPCC Failed to parse SDP: SDP Parse Error on line 50:  c= connection
  line not specified for every media level, validation failed.

According to the RFC
[4566 5.7](https://datatracker.ietf.org/doc/html/rfc4566#section-5.7)

  A session description MUST contain either at least one "c=" field in
  each media description or a single "c=" field at the session level.
  It MAY contain a single session-level "c=" field and additional "c="
  field(s) per media description, in which case the per-media values
  override the session-level settings for the respective media.

I don't see any errors in the Pion repos for this. Interestingly the
webrtc-rs project that is porting Pion to rust has
[an issue](https://github.com/webrtc-rs/webrtc/issues/144)
where they're encountering this same error.
2022-05-02 10:46:31 -04:00
Yutaka Takeda
9f990dbca4 Fix ice-lite attribute
Fixes #2195
2022-04-27 17:07:09 -07:00
Sean DuBois
157220e800 Run gofmt to add new build constraints
Also remove some 1.13 specific WASM code
2022-01-17 22:36:01 -05:00
Sean DuBois
2699584e9a Handle unknown ICE Candidate Type
rfc8839#section-5.1 specifies that a WebRTC Agent MUST
ignore any name/value pairs it doesn't understand. When
we parse a candidate and it fails because we don't understand
the type we now log and continue.

Resolves pion/webrtc#1949
2021-12-15 13:37:34 -05:00
digitalix
f93ea80d85 Revert "Make RTPTransceiver Stopped an atomic"
This reverts commit 6c3620093d.
This commit would cause sender.ReadRTCP() to never return
even when pc associated with this sender was closed.
The aftermath is leaked goroutines that will never stop.
2021-09-24 18:46:42 +01:00
Sean DuBois
6c3620093d Make RTPTransceiver Stopped an atomic
Add an accessor to make getting value easy. Also add
TestPeerConnection_SkipStoppedTransceiver. This commit also cleans
up RTPTransceiver creation. We used a helper function, when we should
have just used the provide constructor
2021-09-04 15:15:36 -04:00
Sean DuBois
d570b78ae1 Implement SSRC Based Simulcast
Resolves #1345
2021-08-28 11:00:44 -04:00
Sean DuBois
89042ee5f6 Don't consider simulcast for undeclared SSRC
If we have a media section with no SSRC we would fire an OnTrack. This
code now properly ignores a MediaSection that has a rid attribute.

Resolves #1808
2021-08-24 17:02:21 -04:00
digitalix
f524fea32a Implement SetCodecPreferences in RTPTransceiver
This allows to set supported codecs per transceiver.

Resolves #1847
2021-06-28 10:54:31 -04:00
tarrencev
5ee9a316a9 Export mime types
Export mime types from media enginer for matching
2020-12-06 00:58:06 -05:00
Sean DuBois
7edfb701e0 New Track API
The Pion WebRTC API has been dramatically redesigned. The design docs
are located here [0]

You can also read the release notes [1] on how to migrate your
application.

[0] https://github.com/pion/webrtc-v3-design
[1] https://github.com/pion/webrtc/wiki/Release-WebRTC@v3.0.0
2020-11-15 09:20:47 -08:00
Sean DuBois
2155a7d703 Move candidate parsing to pion/ice
Instead of having logic in pion/webrtc and pion/sdp move all logic to
pion/ice. Users of pion/ice don't want to import these packages to use
basic pion/ice functionality.
2020-09-13 00:05:09 -07:00
Jason
6ee528d349 Add Simulcast support
Resolves #1016
2020-07-24 01:01:43 -07:00
Jason
58956684f8 Implement answering to RIDs
When responding to a remote description
with RIDs we now properly respond
2020-07-10 15:14:44 -07:00
Sean DuBois
ef1d5a4a8b Add extmap support
Extmaps are configured via the SettingEngine. This allows a user
to set arbitrary values, and when answering ids and entries are
properly excluded.

Co-authored-by: Gabor Pongracz <gabor.pongracz@proemergotech.com>
2020-07-03 01:01:56 -07:00
Woodrow Douglass
baf14a9af4 Media Level Fingerprints Configuration Option
This commit adds an option to put DTLS Fingerprint specification
at the media description level rather then the session description
level. This enhances compatibility with some 3rd party webrtc
implementations (notably Kurento).
2020-06-30 01:37:15 -07:00
Sean DuBois
3a60d8dae8 Support ICE values at session level
Also add tests to assert we don't have conflicting values. This could
have happened before but we never tested for it.
2020-06-10 00:17:06 -07:00
Sean DuBois
f78334d9d4 Only start SCTP if RemoteDescription requests
Relates to #346
2020-05-18 00:05:40 -07:00
Simone Gotti
9cd89ddc00 Start the right receiver
From PR #1158 during negotiation every required transceiver is assigned
to a specific media section (using the media section mid value).

The same should be done when starting receivers. We should start the
receiver assigned to the media section of that track.
2020-05-06 19:37:45 +02:00
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