New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firefox case when screen and camera offer together #2107
base: master
Are you sure you want to change the base?
Changes from all commits
e5c9056
9498a64
55de02b
ad48d0d
f400e1a
687d924
de26dbf
5e99129
9757a0e
0049913
1d3ab0f
420fc85
e0baf30
6a63f16
5a5c1ce
395cb28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1091,6 +1091,14 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { | |
_ = t.SetCodecPreferences(filteredCodecs) | ||
} | ||
|
||
if extensions, err := rtpExtensionsFromMediaDescription(media); err == nil { | ||
headerExtensions := []RTPHeaderExtensionParameter{} | ||
for uri, id := range extensions { | ||
headerExtensions = append(headerExtensions, RTPHeaderExtensionParameter{URI: uri, ID: id}) | ||
} | ||
_ = t.SetHeaderExtensions(headerExtensions) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Storing the extension from SDP media description in the transceiver. |
||
case direction == RTPTransceiverDirectionRecvonly: | ||
if t.Direction() == RTPTransceiverDirectionSendrecv { | ||
t.setDirection(RTPTransceiverDirectionSendonly) | ||
|
@@ -1203,7 +1211,7 @@ func (pc *PeerConnection) startReceiver(incoming trackDetails, receiver *RTPRece | |
|
||
for _, t := range receiver.Tracks() { | ||
if t.SSRC() == 0 || t.RID() != "" { | ||
return | ||
continue | ||
Sean-Der marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
go func(track *TrackRemote) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ type RTPTransceiver struct { | |
receiver atomic.Value // *RTPReceiver | ||
direction atomic.Value // RTPTransceiverDirection | ||
|
||
codecs []RTPCodecParameters // User provided codecs via SetCodecPreferences | ||
codecs []RTPCodecParameters // User provided codecs via SetCodecPreferences | ||
headerExtensions []RTPHeaderExtensionParameter | ||
|
||
stopped bool | ||
kind RTPCodecType | ||
|
@@ -80,6 +81,33 @@ func (t *RTPTransceiver) getCodecs() []RTPCodecParameters { | |
return filteredCodecs | ||
} | ||
|
||
// SetHeaderExtensions stores header extension from SDP | ||
func (t *RTPTransceiver) SetHeaderExtensions(headerExtensions []RTPHeaderExtensionParameter) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be ok if we did RTPSender.SetParameters I don't see this exposed on the receiver side. Still looking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went with parallel to |
||
t.mu.Lock() | ||
defer t.mu.Unlock() | ||
|
||
t.headerExtensions = headerExtensions | ||
return nil | ||
} | ||
|
||
func (t *RTPTransceiver) hasHeaderExtension(uri string) bool { | ||
t.mu.RLock() | ||
defer t.mu.RUnlock() | ||
|
||
// if nothing specific set, accept all | ||
if len(t.headerExtensions) == 0 { | ||
return true | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to add this accept all case to fix a test. But, I think this is fine to keep the old behaviour. |
||
|
||
for _, he := range t.headerExtensions { | ||
if he.URI == uri { | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
// Sender returns the RTPTransceiver's RTPSender if it has one | ||
func (t *RTPTransceiver) Sender() *RTPSender { | ||
if v := t.sender.Load(); v != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for point 1 in the PR commit notes. More than one media description of the same kind was getting ignored.