Restart API on receiver. (#4200)

Can be used when track moves forward/backward.
This commit is contained in:
Raja Subramanian
2025-12-27 03:42:23 +05:30
committed by GitHub
parent 25ece1e911
commit bb00c86489
2 changed files with 17 additions and 0 deletions
+11
View File
@@ -151,6 +151,10 @@ type TrackReceiver interface {
// VideoSizes returns the video size parsed from rtp packet for each spatial layer.
VideoSizes() []buffer.VideoSize
// closes all associated buffers and issues a resync to all attached downtracks so that
// they can resync and have proper sequncing without gaps in sequence numbers / timestamps
Restart(reason string)
}
// --------------------------------------
@@ -350,6 +354,13 @@ func (r *ReceiverBase) UpdateTrackInfo(ti *livekit.TrackInfo) {
r.streamTrackerManager.UpdateTrackInfo(ti)
}
func (r *ReceiverBase) Restart(reason string) {
r.bufferMu.Lock()
defer r.bufferMu.Unlock()
r.resyncLocked(reason)
}
func (r *ReceiverBase) resyncLocked(reason string) {
// resync to avoid gaps in the forwarded sequence number
r.params.Logger.Debugw("resync receiver", "reason", reason)