Skip to content

Conversation

@alexlivekit
Copy link
Contributor

No description provided.

@alexlivekit alexlivekit requested a review from a team as a code owner January 22, 2026 01:11
p.stats.Streams.Add(1)
p.mediaReceived.Break()
log := p.log.WithValues("ssrc", ssrc)
log.Infow("accepting RTP stream")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to include discarded packets number, and first RTP seq

// such as in outbound calls that take a sec to answer, we have a ton of junk in the stream.
// We need to discard all of it.
now := time.Now()
if lastPacketTime.IsZero() || now.Sub(lastPacketTime) < time.Millisecond {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, for inbound calls, we will discard the first packet as well, even if there isn't anything buffered in there.
We can, of course introduce code to correct for that, but the added complexity was deemed not justified due to non-existing impact.

}
if catchup {
// When a remote writer has been sending data but the local stream didn't start the RTP loop,
// such as in outbound calls that take a sec to answer, we have a ton of junk in the stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'm following here.

There's presumably some garbage sent before the call is established. But the code in the PR doesn't even check the RTP headers or the payload. Why are we dropping it unconditionally?

Assuming there's some audio there (silence? ringing?) or even just audio junk, it won't propagate through the media pipeline until it's actually enabled (we have multiple SwitchWriters in the pipeline that can cut the stream).

So why is this necessary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants