Commit Graph

320 Commits

Author SHA1 Message Date
Xiaobo Liu
4f67c90d22 Replace custom atomicBool with sync/atomic.Bool
- Remove custom atomicBool implementation
- Replace all atomicBool usages with standard library sync/atomic.Bool

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2025-06-25 18:05:03 +08:00
3DRX
4742d1fd54 Fix trackDetailsFromSDP not handling fec ssrc 2025-05-27 15:18:12 +06:00
Nils Ohlmeier
716beb568e Use space after WMS. Fixes #3128 2025-05-22 11:16:35 -06:00
Joe Turki
465d8bd950 Reject candidates from old generation
Return an error if a candidate with a username fragment that does
not match the username fragment in the remote description is added.
This usually indicates that the candidate was generated before the
renegotiation.
2025-04-27 18:34:45 +03:00
Nils Ohlmeier
5676fa4d38 Don't expose new MediaEngine functions 2025-04-15 11:54:34 -06:00
Nils Ohlmeier
a561371028 Made multi codec the default 2025-04-15 11:54:34 -06:00
Nils Ohlmeier
be8800d522 Implemented alternative proposal via SettingEngine 2025-04-15 11:54:34 -06:00
sirzooro
77fc1cb069 Added missing lock 2025-04-12 20:40:54 +02:00
Joe Turki
5ce8e05d22 Resolve undeclared SSRC using the payload type
Introduces a fallback mechanism to handle undeclared SSRCs from multiple
sections using the RTP stream's payload type. For legacy clients
without MID extension support, it documents the existing behavior for
handling undeclared SSRCs in single media sections.
2025-03-19 07:50:16 +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
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
Juliusz Chroboczek
f2191fbfa7 Finish moving SDESRTPStreamIDURI (#3000)
Finish moving SDESRTPStreamIDURI from here to pion/sdp.
2025-01-13 09:25:13 -05: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
Aleksandr Alekseev
3f246fdad2 Close interceptor after PeerConnection is closed 2024-12-24 23:12:04 +03:00
boks1971
9eee2cc038 Remove stopped member from RTPTransceiver
It is unused. If needed in the future we can add it back
2024-12-14 20:07:11 -05:00
Juliusz Chroboczek
2585a2fd03 Improve the documentation of NewPeerConnection 2024-12-14 19:43:44 -05:00
cnderrauber
8e2c8682de Add option to disable close by dtls
Close peerconnection on DTLS.CloseNotify
could break ice restart with dtls restart,
when the dtls finger-print changed, the
browser could teardown the old dtlstransport
and establish new one then pion could close
the peerconnection and restart failed. So
browser don't do this and spec also don't
say peerconnection should close when dtls
is closed.
2024-11-29 08:09:21 -05:00
Eric Daniels
76634b143a Add SetFireOnTrackBeforeFirstRTP 2024-10-15 12:10:07 -04:00
Sean DuBois
32f7063f1a Send FEC and RTX PayloadType into interceptor
New fields added to interceptor.StreamInfo
2024-10-04 21:33:10 -04: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
cnderrauber
e6a86e74b9 Don't reuse transceiver in one round negotiation
Should not reuse transceiver (remove & add track)
in one round negotiation, it cause the transceiver
changes ssrc/id without transit to inactive and the
remote peer connection can't fire track close and
OnTrack event.
2024-09-06 14:55:33 +00:00
Eric Daniels
9a61d68237 Fix concurrent pc.GracefulClose 2024-08-26 10:50:45 -04:00
Eric Daniels
48a2e5a0cc Revert "Run ops.GracefulClose earlier in pc.Close"
This reverts commit ec6b6f1d54.
2024-08-14 14:36:04 -04:00
Eric Daniels
ec6b6f1d54 Run ops.GracefulClose earlier in pc.Close 2024-08-13 09:29:11 -04:00
Sean DuBois
3aab0355e0 Upgrade dtls, ice, stun and turn
New major version of all packages caused by DTLS upgrade
2024-08-12 13:45:35 -04:00
Eric Daniels
78c8a2e07c Add PeerConnection.GracefulClose 2024-08-06 09:51:54 -04: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
Eric Daniels
05cafb3d03 Close unhandled rtcp simulcast streams
handleIncomingSSRC will call streamsForSSRC which
opens rtp/rtcp streams that if unhandled can be
leaked resources. Now we will proactively open
them before calling handleIncomingSSRC and close
then later. In the future it would be better to
do this inside handleIncomingSSRC to protect other
callers.
2024-07-23 00:03:17 -04:00
Sean DuBois
c85269bee3 Properly handle non-media probes
libwebrtc has started sending media probes on an unannounced SSRC(0).
Currently Pion will ignore this as the SSRC hasn't been declared
explicitly and no RID/MID RTP Headers.

This adds a special case to accept SSRC 0 and Read the RTP packets. This
allows the TWCC reports to properly be generated.
2024-07-20 22:16:22 -04:00
Eric Daniels
17d3e97b59 Hold pc.mu while populating local candidates 2024-07-19 12:05:41 -04:00
cnderrauber
287d10638d Match header extensions to remote media sections
Firefox would send updated header extension
in renegotiation, e.g. publish a track without
simucalst then renegotiate second track with
simucalst, the two media secontions will have
different rtp header extensions in offer. Need
to match remote header extentions for each
media sections to avoid second track publish
failed.
2024-07-18 12:30:19 +08:00
Sean DuBois
e17ce04589 Revert 7c8bfbd44a and add test
Don't block Close on spawned goroutines
2024-07-15 11:26:21 -04:00
Eric Daniels
7c8bfbd44a Make pc.Close wait on spawned goroutines to close 2024-07-01 20:54:27 -04:00
Eric Daniels
1bb9fa9020 Make onNegotiationNeeded conform to spec
- Removes non-canon logic
2024-06-24 11:03:40 -04:00
Eric Daniels
ca05618c7f Reset state machine after negotiationNeededOp
- Fixes #2774
2024-06-11 13:49:06 -04:00
knowmost
a97c420d0c Fix typos in multiple comments 2024-04-27 23:27:55 -04:00
Sean DuBois
92df4bf0ec Include msid-semantic in Session Attributes
Chrome doesn't include the msid when responding to
recvonly transceivers

See crbug[0] for discussion

[0] https://issues.chromium.org/u/1/issues/328522463
2024-04-01 13:25:22 -04:00
sukun
835ac3b08e Drop reference to detached datachannels
This allows users of detached datachannels to garbage collect
resources associated with the datachannel and the sctp stream.
There is no functional change here.
2024-03-24 22:21:35 -04:00
Andrei Nistor
313ca8c314 Refactor NewPeerConnection
Skip registering the default codecs and interceptors in
NewPeerConnection.
The NewAPI() function already registers them by default  (since #2630)
2024-03-18 09:45:45 -04:00
Sean DuBois
6190b2df6c Update module github.com/pion/sdp to v3.0.8 2024-03-06 22:25:19 -05:00
cnderrauber
2407bf2ed2 Refine rtx support
Always handle header extensions from packet read
from interceptor, let interceptor has consistent
chance to process headers

Fix rtx is not negotiated when there is multiple
codecs has same mime but different profile (H264)

Fix rtx stream info missed when SSRC group attr
shows after base track's ssrc attr.
2024-02-05 22:48:24 +08:00
cnderrauber
dae5e8e1a0 Skip padding packet for simulcast probe
Skip padding packet for simulcast probe
Fix rtx attributes panic for nil map
2024-02-01 22:57:05 -08:00
Mikhail
759fc73984 Respect SSRC Choice by User
Respect SSRC chosen via RTPTransceiverInit
2023-09-14 14:08:38 -04:00
Sean DuBois
b549c9580d Enable Simulcast RTP Headers by default
Relates to #2557
2023-09-13 12:38:26 -04:00
Woodrow Douglass
13450332a4 Remove the "Unknown" constant
This commit replaces the Unknown constant with
separate constants for each enumeration that
uses it.

Fixes #1293
2023-09-12 13:29:05 -04:00
Sean DuBois
5cf4168432 Fix OnICEGatheringStateChange Signature
Return ICEGatheringState not ICEGathererState

Relates to #2557
2023-09-11 14:32:23 -04:00
Aleksandr Alekseev
e507d46e1c Improve checkNegotiationNeeded replaceTrack
replaceTrack with nil would cause a crash
2023-09-08 14:08:02 -04: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
Sean DuBois
dc4b591c4d Start pion/webrtc/v4
60eea43 is a breaking change
2023-09-05 11:48:14 -04:00
Sean DuBois
60eea430ac Close PeerConnection on DTLS CloseNotify
Resolves #1767
Resolves pion/dtls#151
2023-09-05 04:52:17 -04:00