-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Consider first packet when reading Simulcast IDs #3144
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
4d620ca
6770cfa
bf06fe4
95a37ee
d8e4477
be4f995
94f9209
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 |
|---|---|---|
|
|
@@ -1784,7 +1784,20 @@ func (pc *PeerConnection) handleIncomingSSRC(rtpStream io.Reader, ssrc SSRC) err | |
| return err | ||
| } | ||
|
|
||
| // try to read simulcast IDs from the packet we already have | ||
| var mid, rid, rsid string | ||
| if _, err = handleUnknownRTPPacket( | ||
| b[:i], uint8(midExtensionID), //nolint:gosec // G115 | ||
| uint8(streamIDExtensionID), //nolint:gosec // G115 | ||
| uint8(repairStreamIDExtensionID), //nolint:gosec // G115 | ||
| &mid, | ||
| &rid, | ||
| &rsid, | ||
| ); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| // if the first packet didn't contain simuilcast IDs, then probe more packets | ||
| var paddingOnly bool | ||
| for readCount := 0; readCount <= simulcastProbeCount; readCount++ { | ||
| if mid == "" || (rid == "" && rsid == "") { | ||
|
|
@@ -1798,7 +1811,7 @@ func (pc *PeerConnection) handleIncomingSSRC(rtpStream io.Reader, ssrc SSRC) err | |
| return err | ||
| } | ||
|
|
||
| if _, paddingOnly, err = handleUnknownRTPPacket( | ||
| if paddingOnly, err = handleUnknownRTPPacket( | ||
|
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. Lint complained that |
||
| b[:i], uint8(midExtensionID), //nolint:gosec // G115 | ||
| uint8(streamIDExtensionID), //nolint:gosec // G115 | ||
| uint8(repairStreamIDExtensionID), //nolint:gosec // G115 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -291,21 +291,20 @@ func handleUnknownRTPPacket( | |
| streamIDExtensionID, | ||
| repairStreamIDExtensionID uint8, | ||
| mid, rid, rsid *string, | ||
| ) (payloadType PayloadType, paddingOnly bool, err error) { | ||
| ) (paddingOnly bool, err error) { | ||
| rp := &rtp.Packet{} | ||
| if err = rp.Unmarshal(buf); err != nil { | ||
| return 0, false, err | ||
| return false, err | ||
| } | ||
|
|
||
| if rp.Padding && len(rp.Payload) == 0 { | ||
| paddingOnly = true | ||
| } | ||
|
|
||
| if !rp.Header.Extension { | ||
| return payloadType, paddingOnly, nil | ||
| return paddingOnly, nil | ||
| } | ||
|
|
||
| payloadType = PayloadType(rp.PayloadType) | ||
| if payload := rp.GetExtension(midExtensionID); payload != nil { | ||
| *mid = string(payload) | ||
| } | ||
|
|
@@ -318,5 +317,5 @@ func handleUnknownRTPPacket( | |
| *rsid = string(payload) | ||
| } | ||
|
|
||
| return payloadType, paddingOnly, nil | ||
| return paddingOnly, nil | ||
|
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. Lint complained that |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.