Skip to content

fix: work around RTCP SR not sent for all SSRCs#2031

Merged
getroot merged 3 commits intomasterfrom
fix/lip-sync-partial-rtcp-sr
Mar 19, 2026
Merged

fix: work around RTCP SR not sent for all SSRCs#2031
getroot merged 3 commits intomasterfrom
fix/lip-sync-partial-rtcp-sr

Conversation

@getroot
Copy link
Copy Markdown
Member

@getroot getroot commented Mar 19, 2026

Per the RTP/RTCP spec, a sender must send RTCP SR for every SSRC it uses. However, some RTP-based sources only send SR for a subset of their SSRCs.

This issue was observed with OBS 32.1.0 sending WHIP Simulcast.

This patch works around the issue by not starting until RTCP SR is received for all registered SSRCs, and reduces the fallback timeout from 5 seconds to 3 seconds so it falls back to per-track timestamp calculation without RTCP SR more quickly.


Update: Also made LipSyncClock thread-safe in preparation for potential future multi-threaded use. Currently RTP and RTCP are always handled on the same thread, so there is no practical issue today.

@getroot getroot requested a review from a team as a code owner March 19, 2026 05:54
@getroot getroot requested review from dimiden and removed request for a team March 19, 2026 05:54
@getroot
Copy link
Copy Markdown
Member Author

getroot commented Mar 19, 2026

I have improved the LipSyncClock library so that it works well in a multi-threaded environment. (Although this is not an issue since it is currently used in a single-threaded environment,) please review it again.
@dimiden

@getroot getroot requested a review from dimiden March 19, 2026 11:26
@dimiden
Copy link
Copy Markdown
Member

dimiden commented Mar 19, 2026

I have improved the LipSyncClock library so that it works well in a multi-threaded environment. (Although this is not an issue since it is currently used in a single-threaded environment,) please review it again. @dimiden

If clock->_updated = true is set in UpdateSenderReportTime() and then CalcPTS() evaluates if (clock->_updated == false) right after, could this lead to unexpected results when calculating pts?
(If this level of discrepancy does not have a meaningful impact, please feel free to disregard this comment.)

@getroot
Copy link
Copy Markdown
Member Author

getroot commented Mar 19, 2026

@dimiden That is a good point. Considering multithreading, the clock must be atomic. I have patched this.

@dimiden
Copy link
Copy Markdown
Member

dimiden commented Mar 19, 2026

LGTM 👍

@getroot getroot merged commit ad64c7a into master Mar 19, 2026
2 checks passed
@getroot getroot deleted the fix/lip-sync-partial-rtcp-sr branch March 19, 2026 13:36
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.

2 participants