Repository navigation
wFix critical agent recording issues: layer init, downtrack race, debu… - #4003
Conversation
6f5e5eb to
1031846
Compare
| } | ||
|
|
||
| func (r *WrappedReceiver) AddDownTrack(track sfu.TrackSender) error { | ||
| r.lock.Lock() |
There was a problem hiding this comment.
The method should be called after DetermineReceiver is called: Downtrack.OnCodecNegotiated -> Downtrack.OnBiding->Receiver.AddTrack, so trackReceiver should not be null. Even if the receiver is null, it will be panic not lost silently.
|
|
||
| f.logger.Debugw("setting max spatial layer", "layer", spatialLayer) | ||
| f.vls.SetMaxSpatial(spatialLayer) | ||
| return true, f.vls.GetMax() |
There was a problem hiding this comment.
This one should trigger a stream allocator allocation which will set the layers -
Line 1394 in 7930dcd
Which version of the server are you seeing these issues in? These are common use cases where we have not seen issues.
Can you please share server side logs showing the problem?
1031846 to
1968dd1
Compare
Update: Removed Issue 2 After Further TestingThank you for the thorough review, especially questioning Issue 2. You were correct. I rebuilt the LiveKit server with only Issue 1 applied (forwarder layer initialisation) and ran the full E2E test. Issue 2 was a misdiagnosis. The symptoms I attributed to a receiver race condition (numDownTracks=0 in logs) were actually caused by Issue 1's invalid forwarder layers. Once layers are properly initialised, packets forward correctly and downtracks work as designed. Updated PR I've force-pushed to include only Issue 1 (forwarder layer initialization). The PR now contains:
Regarding Issue 1: Stream Allocator Async Race You mentioned this should trigger stream allocator allocation via OnSubscribedLayerChanged (downtrack.go:1394). You're absolutely right that the allocator is designed to set layers. However, I discovered there's a timing race with the async event queue: The Flow // streamallocator.go:499-515 Timeline in Agent Scenario:
Why Normal P2P Works
Why Agent Scenario Fails
Minimal Reproduction I've created a standalone 250-line program that demonstrates this timing issue main.go.zip Results:
My Fix: Defensive Initialisation func (f *Forwarder) SetMaxSpatialLayer(spatialLayer int32) (bool, buffer.VideoLayer) { } Rationale:
Questions for You
The timing issue is real and reproducible - I just want to fix it in the right place architecturally. |
|
Thank you for all the details @am-sokolov . Really appreciate it. Let me review this once again and get back to you. I think the defensive initialisation you have is probably fine. But, I wanted to look up historical notes to make sure that it does not introduce some unexpected behaviour for some cases. |
| } | ||
| } | ||
| f.logger.Infow("updated max spatial layer", "newMax", newMax) | ||
| return true, newMax |
There was a problem hiding this comment.
Thank you for doing this.
Can you please make three changes?
- Check for
isDeficientLocked. If true, do not set target. That means the congestion controller is throttling this track. So, it should be left to stream allocator to unblock this. - Do not set
currentlayer. The forwarder start should happen on a key frame and layer selectors look for that. - Log once indicating that an opportunistic target is set. Also, can you please make it
Debugw. This could happen in a lot of cases and would be good to have it at Debug level only.
1968dd1 to
af24542
Compare
|
Thank you for the feedback! I've updated the PR with all three changes:
|
|
Thank you very much @am-sokolov . Will merge this shortly. |
|
@am-sokolov Can you please sign the CLA so that we can accept this PR and merge? - https://cla-assistant.io/livekit/livekit?pullRequest=4003 |
|
Done |
Apologies for the delay @am-sokolov . This needs to be signed by the same GH user who is committing to the repo. Looks like GH user CEO committed. |
|
@am-sokolov Please let me know if you can sign using GH user CEO which was used to commit code. I can take the changes and apply it too, but it would be good to have your contribution attributed correctly. |
When SetMaxSpatialLayer() is called with target/current layers in InvalidLayerSpatial state, opportunistically initialize the target layer to avoid dropped packets during async stream allocator initialization. Guards: - Only sets target if not congestion-throttled (isDeficientLocked) - Does not set current layer (deferred to keyframe-based forwarder start) - Logs at Debug level to avoid log noise This prevents undefined layer state during manual subscription with immediate quality upgrades (WithAutoSubscribe(false) + SetVideoQuality(HIGH)).
af24542 to
c275b77
Compare
|
I've updated the commit author so the CLA bot should recognize me now. However, it looks like the staticcheck CI is running into an issue that seems unrelated to my changes: This appears to be a compatibility issue between the staticcheck action and golang.org/x/tools. I noticed other CI checks are passing fine, so I think this might be an infrastructure hiccup rather than something with the code itself. Would you mind taking a quick look when you get a chance? Happy to help debug if needed, or if you want me to try anything on my end! Thanks for your patience with the CLA stuff earlier - I think we should be all set now. |
|
Thank you @am-sokolov . Really appreciate it. I will take a look. |
|
Looks like |
…0 → v1.11.0) (#484) This PR contains the following updates: | Package | Update | Change | |---|---|---| | [docker.io/livekit/livekit-server](https://github.com/livekit/livekit) | minor | `v1.9.0` → `v1.11.0` | --- ### Release Notes <details> <summary>livekit/livekit (docker.io/livekit/livekit-server)</summary> ### [`v1.11.0`](https://github.com/livekit/livekit/releases/tag/v1.11.0) [Compare Source](livekit/livekit@v1.10.1...v1.11.0) NOTE: Minor version bump that enables data tracks (<https://docs.livekit.io/transport/data/data-tracks/>) by default. ##### Added - Embedded turn test ([#​4412](livekit/livekit#4412)) - chore: log API key during worker registration ([#​4428](livekit/livekit#4428)) - Add some simple data track stats ([#​4431](livekit/livekit#4431)) - Add `Close` method for UpDataTrackManager and call it on participant ([#​4432](livekit/livekit#4432)) - Log join duration. ([#​4433](livekit/livekit#4433)) - Add subscriber stream start event notification ([#​4449](livekit/livekit#4449)) ##### Changed - Cleaning up some logs and standardising log frequency. ([#​4420](livekit/livekit#4420)) - Keep subscription synchronous when publisher is expected to resume. ([#​4424](livekit/livekit#4424), [#​4425](livekit/livekit#4425)) - Do not close publisher peer connection to aid migration. ([#​4426](livekit/livekit#4426), [#​4427](livekit/livekit#4427)) - Enable data tracks by default. ([#​4429](livekit/livekit#4429)) - chore: pin GH commits and switch to golangci-lint ([#​4444](livekit/livekit#4444)) - Switch to stdlib maps, slices ([#​4445](livekit/livekit#4445)) - Store concrete ICE candidate for remote candidates. ([#​4458](livekit/livekit#4458)) ##### Fixed - clear track notifier observers on subscription teardown ([#​4413](livekit/livekit#4413)) - Guard against timestamp inversion in RED -> Opus conversion. ([#​4414](livekit/livekit#4414), [#​4415](livekit/livekit#4415), [#​4418](livekit/livekit#4418)) - ensure participant init is correctly serialized for logging ([#​4417](livekit/livekit#4417)) - Clean up data track observers on unsubscribe. ([#​4421](livekit/livekit#4421)) - compute agent dispatch affinity from target load ([#​4442](livekit/livekit#4442)) - Apply IPFilter when get local ip ([#​4440](livekit/livekit#4440)) - Unsubscribe from data track on close ([#​4443](livekit/livekit#4443)) - Use Muted in TrackInfo to propagated published track muted. ([#​4453](livekit/livekit#4453)) - fix: limit join request and WHIP request body to http.DefaultMaxHeaderBytes ([#​4450](livekit/livekit#4450)) - fix publisher frame count reporting for simulcast streams ([#​4457](livekit/livekit#4457)) ### [`v1.10.1`](https://github.com/livekit/livekit/releases/tag/v1.10.1) [Compare Source](livekit/livekit@v1.10.0...v1.10.1) ##### Added - add packet trailer stripping support ([#​4361](livekit/livekit#4361)) - Path check helpers ([#​4392](livekit/livekit#4392)) - add deadline to dtls connect context ([#​4395](livekit/livekit#4395)) - feat(agent-dispatch): add job restart policy ([#​4401](livekit/livekit#4401)) ##### Changed - Close both peer connections to aid migration. ([#​4382](livekit/livekit#4382)) ##### Fixed - Fix TURN server URL ([#​4389](livekit/livekit#4389)) - AV1 parser overflow fix. ([#​4405](livekit/livekit#4405)) - Address malformed H264/H265 parsing issues ([#​4407](livekit/livekit#4407)) ### [`v1.10.0`](https://github.com/livekit/livekit/releases/tag/v1.10.0) [Compare Source](livekit/livekit@v1.9.12...v1.10.0) ##### PLEASE NOTE: The logging key for participant session ID (a.k.a participant SID) has been changed from `pID` to `participantID` in this release for the sake of clarity. Hence the minor version bump. ##### Added - Add option to require media sections when participant joining ([#​4347](livekit/livekit#4347), [#​4354](livekit/livekit#4354)) - Support originating calls from custom domains ([#​4349](livekit/livekit#4349)) - Add StopEgress function to the EgressLauncher interface ([#​4353](livekit/livekit#4353)) - Add option to not re-use transceiver in e2ee. ([#​4356](livekit/livekit#4356)) - Add API to restart lite stats. ([#​4366](livekit/livekit#4366), [#​4368](livekit/livekit#4368)) * handle AGENT\_ERROR disconnect reason ([#​4339](livekit/livekit#4339)) ##### Changed - Mark last run of grow bucket outside goroutine. ([#​4348](livekit/livekit#4348)) - Refine ipv6 support ([#​4352](livekit/livekit#4352)) - Sample data send error logging. ([#​4358](livekit/livekit#4358)) - Switch data track extension to 1-byte ID/length. ([#​4362](livekit/livekit#4362)) - Do not kick off migration of closed participant ([#​4363](livekit/livekit#4363)) - Do not block all ext ID determination on stream allocator listener ([#​4364](livekit/livekit#4364)) - Rename log field pID to participantID ([#​4365](livekit/livekit#4365)) - Replace deprecated io/ioutil with io in whipservice ([#​4375](livekit/livekit#4375)) - Update grpc to address CVE-2026-33186 ([#​4381](livekit/livekit#4381)) ##### Fixed - Fix repair stream ID reporting for RTX pairing. ([#​4369](livekit/livekit#4369)) ### [`v1.9.12`](https://github.com/livekit/livekit/releases/tag/v1.9.12) [Compare Source](livekit/livekit@v1.9.11...v1.9.12) ##### Added - Add silent frame for pcmu/a ([#​4258](livekit/livekit#4258)) - adds a test to ensure agent worker errors cause disconnection ([#​4273](livekit/livekit#4273)) - Populate client\_protocol field in ParticipantInfo ([#​4293](livekit/livekit#4293)) - Read client protocol from query param ([#​4294](livekit/livekit#4294)) - generate & log egressID for start egress request ([#​4303](livekit/livekit#4303)) - ESP32 Client Info ([#​4267](livekit/livekit#4267)) - feat: make INSTALL\_PATH overridable in install script ([#​3954](livekit/livekit#3954)) ##### Changed - Defer setting clock rate in RTPStats module till codec is bound. ([#​4250](livekit/livekit#4250)) - Wrapping SIP errors for invalid argument and not found ([#​4253](livekit/livekit#4253)) - Ignore parse addr error when add remote candidate ([#​4264](livekit/livekit#4264)) - Generate config flags ([#​4268](livekit/livekit#4268)) - clear reference guard when resetting signal stats ([#​4279](livekit/livekit#4279)) - refresh telemetry guard on participant move ([#​4280](livekit/livekit#4280)) - use separate allocation for signal stats telemetry guard ([#​4281](livekit/livekit#4281)) - Set up audio config in audio level module when config is updated. ([#​4290](livekit/livekit#4290)) - Update self-hosting deployment documentation link ([#​4312](livekit/livekit#4312)) - Key telemetry stats worker using combination of roomID, participantID ([#​4323](livekit/livekit#4323)) - Two phase restart when doing external restart of receiver. ([#​4329](livekit/livekit#4329)) - Send participant left event after track unpublished for moved ([#​4334](livekit/livekit#4334)) ##### Fixed - Fix receiver restart race ([#​4248](livekit/livekit#4248)) - require participant broadcast when metadata/attributes are set in token ([#​4266](livekit/livekit#4266)) - Create buffer if needed when a PLI is requested. ([#​4282](livekit/livekit#4282)) - Do not increase max expected layer on track info update. ([#​4285](livekit/livekit#4285)) - Publish is always on publisher peer connection.([#​4307](livekit/livekit#4307)) - Potential fix for code scanning alert no. 35: Workflow does not contain permissions ([#​4311](livekit/livekit#4311)) - Potential fix for code scanning alert no. 36: Workflow does not contain permissions ([#​4310](livekit/livekit#4310)) - Fix for some CodeQL reported issues ([#​4314](livekit/livekit#4314)) - Protect against incorrect temporal layer. ([#​4327](livekit/livekit#4327)) - do not discount packets lost on duplicate packets ([#​4333](livekit/livekit#4333)) - Use ParticipantTelemetryListener of LocalParticipant. ([#​4342](livekit/livekit#4342)) - Fix SIP client timeout. ([#​4345](livekit/livekit#4345)) ### [`v1.9.11`](https://github.com/livekit/livekit/releases/tag/v1.9.11) [Compare Source](livekit/livekit@v1.9.10...v1.9.11) ##### PLEASE NOTE: The previous release tag v1.9.10 hit a panic under some conditions. Sincerely regret the inconvenience caused. Although we do test rigorously, it is not guaranteed to cover all scenarios. We request you to report any issues you encounter. Thank you. ##### Added - Support OpenTelemetry tracing. Add Jaeger support. ([#​4222](livekit/livekit#4222)) - Add option to force simuclast codec. ([#​4226](livekit/livekit#4226)) - Log timeout in API ([#​4231](livekit/livekit#4231), [#​4232](livekit/livekit#4232)) - Add participant option for data track auto-subscribe. ([#​4240](livekit/livekit#4240)) ##### Changed - Remove enable arrival time forwarding method. ([#​4217](livekit/livekit#4217)) - sfu/receiver and sfu/buffer refactor ([#​4221](livekit/livekit#4221), [#​4224](livekit/livekit#4224), [#​4225](livekit/livekit#4225)) - Change some logs to debugw ([#​4229](livekit/livekit#4229)) - Changing field naming of data track packet ([#​4235](livekit/livekit#4235)) - Update Pion transport package. ([#​4237](livekit/livekit#4237)) - Wrapping the invalid request errors for CreateSipParticipant ([#​4239](livekit/livekit#4239)) ##### Fixed - Swap result sink atomically rather than closing and setting ([#​4216](livekit/livekit#4216)) - Address crash in v1.9.10 ([#​4219](livekit/livekit#4219), [#​4220](livekit/livekit#4220)) - Return on SDP fragment read error. ([#​4228](livekit/livekit#4228)) ### [`v1.9.10`](https://github.com/livekit/livekit/blob/HEAD/CHANGELOG.md#PLEASE-NOTE-The-previous-release-tag-v1910-hit-a-panic-under-some-conditions-Sincerely-regret-the-inconvenience-caused-Although-we-do-test-rigorously-it-is-not-guaranteed-to-cover-all-scenarios-We-request-you-to-report-any-issues-you-encounter-Thank-you) [Compare Source](livekit/livekit@v1.9.9...v1.9.10) ##### Added - Support OpenTelemetry tracing. Add Jaeger support. ([#​4222](livekit/livekit#4222)) - Add option to force simuclast codec. ([#​4226](livekit/livekit#4226)) - Log timeout in API ([#​4231](livekit/livekit#4231), [#​4232](livekit/livekit#4232)) - Add participant option for data track auto-subscribe. ([#​4240](livekit/livekit#4240)) ##### Changed - Remove enable arrival time forwarding method. ([#​4217](livekit/livekit#4217)) - sfu/receiver and sfu/buffer refactor ([#​4221](livekit/livekit#4221), [#​4224](livekit/livekit#4224), [#​4225](livekit/livekit#4225)) - Change some logs to debugw ([#​4229](livekit/livekit#4229)) - Changing field naming of data track packet ([#​4235](livekit/livekit#4235)) - Update Pion transport package. ([#​4237](livekit/livekit#4237)) - Wrapping the invalid request errors for CreateSipParticipant ([#​4239](livekit/livekit#4239)) ##### Fixed - Swap result sink atomically rather than closing and setting ([#​4216](livekit/livekit#4216)) - Address crash in v1.9.10 ([#​4219](livekit/livekit#4219), [#​4220](livekit/livekit#4220)) - Return on SDP fragment read error. ([#​4228](livekit/livekit#4228)) ### [`v1.9.9`](https://github.com/livekit/livekit/releases/tag/v1.9.9) [Compare Source](livekit/livekit@v1.9.8...v1.9.9) ##### Added - Add support for RTP stream restart. ([#​4161](livekit/livekit#4161)) ##### Changed - Avoid duplicate track add to room track manager. ([#​4152](livekit/livekit#4152), [#​4153](livekit/livekit#4153)) - Consistently undo update to sequence number and timestamp when the incoming packet cannot be sequenced. ([#​4156](livekit/livekit#4156)) - deregister observability function when participant is closed ([#​4157](livekit/livekit#4157)) - Ensure subscribe data track handles are unique ([#​4162](livekit/livekit#4162)) - move delete to oss service store ([#​4164](livekit/livekit#4164)) - clean up manual roomservice log redaction ([#​4165](livekit/livekit#4165)) - skip lost sequence number ranges in getIntervalStats ([#​4166](livekit/livekit#4166), [#​4169](livekit/livekit#4169)) ##### Fixed - chore: fix a large number of spelling issues ([#​4147](livekit/livekit#4147)) - Handle case of sequence number jump just after start. ([#​4150](livekit/livekit#4150)) - Drop run away receiver reports. ([#​4170](livekit/livekit#4170)) - Publish/Unpublish counter match. ([#​4173](livekit/livekit#4173)) ### [`v1.9.8`](https://github.com/livekit/livekit/releases/tag/v1.9.8) [Compare Source](livekit/livekit@v1.9.7...v1.9.8) ##### Added - Mark RTCP buffer Write as noinline. (for better heap attribution) ([#​4138](livekit/livekit#4138)) - add debug metric for tracking references ([#​4134](livekit/livekit#4134)) ##### Changed - Use isEnding to indicate if down track could be resumed. ([#​4132](livekit/livekit#4132)) - switch participant callbacks to room to listener interface ([#​4136](livekit/livekit#4136)) - protocol deps to get inactive file adjusted memory usage. ([#​4137](livekit/livekit#4137)) - update webrtc to 4.1.8 to pick up DTLS fingerprint check during handshake ([#​4140](livekit/livekit#4140)) ##### Fixed - Do not pause rid in SDP to prevent race with adaptive streaming ([#​4129](livekit/livekit#4129)) - leak fixes ([#​4131](livekit/livekit#4131), [#​4141](livekit/livekit#4141), [#​4142](livekit/livekit#4142), [#​4143](livekit/livekit#4143), [#​4144](livekit/livekit#4144)) ### [`v1.9.7`](https://github.com/livekit/livekit/releases/tag/v1.9.7) [Compare Source](livekit/livekit@v1.9.6...v1.9.7) ##### Added - Data tracks (experimental and not ready for use) ([#​4089](livekit/livekit#4089)) ##### Changed - log bucket growth ([#​4122](livekit/livekit#4122)) - Update pion/ice to stop gather first on close ([#​4123](livekit/livekit#4123)) - move utils.WrapAround to mediatransportutil ([#​4124](livekit/livekit#4124)) - Let participant close remove the published tracks. ([#​4125](livekit/livekit#4125)) ##### Fixed - Fix concurrent map access for [#​4126](livekit/livekit#4126). ([#​4127](livekit/livekit#4127)) ### [`v1.9.6`](https://github.com/livekit/livekit/releases/tag/v1.9.6) [Compare Source](livekit/livekit@v1.9.4...v1.9.6) ##### Added - Control latency of lossy data channel ([#​4088](livekit/livekit#4088)) - logger proto redaction. ([#​4090](livekit/livekit#4090)) - Record join/publish/subscribe cancellations ([#​4102](livekit/livekit#4102), [#​4104](livekit/livekit#4104)) ##### Fixed - Fix "address" typo in transport logs (addddress → address) ([#​4097](livekit/livekit#4097)) - Clear stereo=1 if stereo is not enabled. ([#​4101](livekit/livekit#4101)) - Participant session close deadlock fixes ([#​4107](livekit/livekit#4107), [#​4113](livekit/livekit#4113), [#​4116](livekit/livekit#4116)) ##### Changed - Switch forwarding latency log to Debugw ([#​4098](livekit/livekit#4098)) - Update mediatransportutil to get OWD estimator relocation ([#​4115](livekit/livekit#4115)) ### [`v1.9.4`](https://github.com/livekit/livekit/releases/tag/v1.9.4) [Compare Source](livekit/livekit@v1.9.3...v1.9.4) ##### Added - Log reason for subscriber not being able to determine codec. ([#​4071](livekit/livekit#4071)) - Kind details for connector ([#​4072](livekit/livekit#4072)) ##### Fixed - Prevent invalid track access while peer connection is shutting down. ([#​4054](livekit/livekit#4054)) ##### Changed - Update PsRPC to get redis pipeliner implementation ([#​4055](livekit/livekit#4055)) - Forwarding latency measurement. ([#​4056](livekit/livekit#4056). [#​4057](livekit/livekit#4057), [#​4059](livekit/livekit#4059), [#​4061](livekit/livekit#4061), [#​4062](livekit/livekit#4062), [#​4067](livekit/livekit#4067), [#​4080](livekit/livekit#4080)) - Update pion/transport to v3.1.1 (to get batch I/O ping-pong buffer) ([#​4070](livekit/livekit#4070)) - Use sync.Pool for objects in packet path. ([#​4066](livekit/livekit#4066)) - Bump protocol to pull sip validation changes and error mapping ([#​4081](livekit/livekit#4081)) ### [`v1.9.3`](https://github.com/livekit/livekit/releases/tag/v1.9.3) [Compare Source](livekit/livekit@v1.9.2...v1.9.3) ##### Added - Opportunistic video layer allocation on setting max spatial layer. ([#​4003](livekit/livekit#4003), [#​4030](livekit/livekit#4030), [#​4031](livekit/livekit#4031), [#​4033](livekit/livekit#4033)) - use env var for GOARCH. ([#​4012](livekit/livekit#4012)) - Use simulcast codec as default policy for audio track. ([#​4040](livekit/livekit#4040)) - Enable AbsCaptureTimeURI in RTC configuration. ([#​4043](livekit/livekit#4043)) - Add prom histogram for forwarding latency and jitter. ([#​4044](livekit/livekit#4044), [#​4045](livekit/livekit#4045)) ##### Fixed - Correct direction for request/response for prom counters. ([#​4027](livekit/livekit#4027)) - Do not bind buffer if codec is invalid. ([#​4028](livekit/livekit#4028)) - Remove \~ from rid which indicates disabled layer to get the actual rid. ([#​4032](livekit/livekit#4032)) - Prevent leakage of previous codec after codec regression. ([#​4035](livekit/livekit#4035), [#​4037](livekit/livekit#4037)) - fix: add missing Unlock() in AddReceiver. ([#​4036](livekit/livekit#4036)) ##### Changed - Some golang modernisation bits. ([#​4106](livekit/livekit#4106)) - Use rtp converter from protocol/utils. ([#​4019](livekit/livekit#4019), [#​4020](livekit/livekit#4020)) - High forwarding latency. ([#​4034](livekit/livekit#4034), [#​4038](livekit/livekit#4038)) - if RingingTimeout is provided, deadline should be set to that timeout. ([#​4018](livekit/livekit#4018)) - Don't warn 0 payload type for PCMU. ([#​4039](livekit/livekit#4039)) ### [`v1.9.2`](https://github.com/livekit/livekit/releases/tag/v1.9.2) [Compare Source](livekit/livekit@v1.9.1...v1.9.2) ##### Added - Use gzip reader pool ([#​3903](livekit/livekit#3903)) - Rpcs for ingress proxy WHIP ([#​3911](livekit/livekit#3911)) - Include agent\_name as a participant attribute ([#​3914](livekit/livekit#3914)) - Clean code as there is no oss sweeper for ingress ([#​3918](livekit/livekit#3918)) - Support simulcasting of audio ([#​3920](livekit/livekit#3920)) - Subscrbed audio codecs - update from remote nodes. ([#​3921](livekit/livekit#3921)) - Log some information around high forwarding latency. ([#​3944](livekit/livekit#3944)) - feat: server rpc apis ([#​3904](livekit/livekit#3904)) - short circuit participant broadcast filter in livestream mode ([#​3955](livekit/livekit#3955)) - Adjust for hold time when fowarding RTCP report. ([#​3956](livekit/livekit#3956)) - Add node\_ip to config-sample.yaml ([#​3960](livekit/livekit#3960)) - add idempotent reference count to telemetry stats worker ([#​3964](livekit/livekit#3964)) - add config for user data recording ([#​3966](livekit/livekit#3966)) - Provide the InputVideo/AudioState to Ingress in WHIPRTCConnectionNotify ([#​3982](livekit/livekit#3982)) - Add encryption datapacket type ([#​3869](livekit/livekit#3869)) - Allow passing inline trunk for outbound calls. ([#​3987](livekit/livekit#3987)) - Log RPC details. ([#​3991](livekit/livekit#3991)) - "Power of Two Random Choices" option for node selection ([#​3785](livekit/livekit#3785)) - Adding ProviderInfo to GetSIPTrunkAuthenticationResponse ([#​3993](livekit/livekit#3993)) - Use answer with mid -> trackID mapping when in single peer connection ([#​4005](livekit/livekit#4005)) - Include mid -> trackID in both SDP offer and answer. ([#​4007](livekit/livekit#4007)) ##### Fixed - add incoming request id to request response message ([#​3912](livekit/livekit#3912)) - Simulcast audio fixes ([#​3925](livekit/livekit#3925)) - Fix dynacast subscriber node clearing on move participant. ([#​3926](livekit/livekit#3926)) - mediatransportutil crash fix for logging local address ([#​3930](livekit/livekit#3930)) - Do DD restart only if DD structure is present. ([#​3935](livekit/livekit#3935)) - Avoid matching on empty track id. ([#​3937](livekit/livekit#3937)) - fix stats worker closed condition ([#​3965](livekit/livekit#3965)) - Update deps to fix redis issue when 1 cluster address is provided ([#​3969](livekit/livekit#3969)) - Revert unintentional change to not handle transport fallback ([#​3970](livekit/livekit#3970)) - Do not panic of redis is not configured ([#​3981](livekit/livekit#3981)) - Sort codec layers when adding track ([#​3998](livekit/livekit#3998)) - Resort to full search for requested quality is not available. ([#​4000](livekit/livekit#4000)) - Do not try to read stats from peer connection after close. ([#​4002](livekit/livekit#4002)) - Update pion/webrtc to prevent GetStats panic. ([#​4004](livekit/livekit#4004)) ##### Changed - update protocol for sip api change ([#​3902](livekit/livekit#3902)) - Refactor subscribedTrack + mediaTrackSubscriptions. ([#​3908](livekit/livekit#3908)) - Set publisher codec preferences after setting remote description ([#​3913](livekit/livekit#3913)) - update protocol for psrpc ([#​3915](livekit/livekit#3915)) - Wait for `SetRemoteDescription` before configuring senders. ([#​3924](livekit/livekit#3924)) - Update mediatransportutil to log external IP found via STUN. ([#​3929](livekit/livekit#3929)) - Add debugging from DD frame number wrap around. ([#​3933](livekit/livekit#3933)) - More debugging of DD jump ([#​3934](livekit/livekit#3934)) - Use difference in key frame counter to stop seeder. ([#​3936](livekit/livekit#3936)) - Update protocol for SipCreateParticipant ([#​3939](livekit/livekit#3939)) - mediatransportutil to log local address when validating external IP ([#​3942](livekit/livekit#3942)) - Use microseconds for forwarding stats. ([#​3943](livekit/livekit#3943)) - Tweaks tresholds for logging high forwarding latency/jitter. ([#​3945](livekit/livekit#3945)) - Flush stats when there are no packets. ([#​3947](livekit/livekit#3947)) - handle terminated job requests ([#​3948](livekit/livekit#3948)) - Switch ops queue a singly linked list. ([#​3949](livekit/livekit#3949)) - Revert "Switch ops queue a singly linked list." ([#​3950](livekit/livekit#3950)) - Adjust stream allocator ping interval based on state. ([#​3951](https://github.com/livekit/livekit/issues/3951)) - avoid logging on small values ([#​3958](https://github.com/livekit/livekit/issues/3958)) - Update protocol for EventKey helper. ([#​3963](https://github.com/livekit/livekit/issues/3963)) - Do not force codec regression between opus and red. ([#​3980](https://github.com/livekit/livekit/issues/3980)) - Do not start forawarding on out-of-order packet. ([#​3985](https://github.com/livekit/livekit/issues/3985)) - Use padding only packets for dummy start of audio. ([#​3984](https://github.com/livekit/livekit/issues/3984)) - Support Opus mixed with RED when encrypted. ([#​3986](https://github.com/livekit/livekit/issues/3986)) - Limit check to red + opus when looking for primary codec match. ([#​3988](https://github.com/livekit/livekit/issues/3988)) - Increment RTP timestamp on padding when using dummy start. ([#​3989](https://github.com/livekit/livekit/issues/3989)) - Revert to using silence packets for audio dummy start. ([#​3999](https://github.com/livekit/livekit/issues/3999)) - Count request/response packets on both client and server side. ([#​4001](https://github.com/livekit/livekit/issues/4001)) - Do not call receiver methods under settings lock. ([#​4006](https://github.com/livekit/livekit/issues/4006)) - counterfeiter needs an older version of x/tools ([#​4009](https://github.com/livekit/livekit/issues/4009)) ### [`v1.9.1`](https://github.com/livekit/livekit/blob/HEAD/CHANGELOG.md#PLEASE-NOTE-The-previous-release-tag-v1910-hit-a-panic-under-some-conditions-Sincerely-regret-the-inconvenience-caused-Although-we-do-test-rigorously-it-is-not-guaranteed-to-cover-all-scenarios-We-request-you-to-report-any-issues-you-encounter-Thank-you) [Compare Source](livekit/livekit@v1.9.0...v1.9.1) ##### Added - Support OpenTelemetry tracing. Add Jaeger support. ([#​4222](livekit/livekit#4222)) - Add option to force simuclast codec. ([#​4226](livekit/livekit#4226)) - Log timeout in API ([#​4231](livekit/livekit#4231), [#​4232](livekit/livekit#4232)) - Add participant option for data track auto-subscribe. ([#​4240](livekit/livekit#4240)) ##### Changed - Remove enable arrival time forwarding method. ([#​4217](livekit/livekit#4217)) - sfu/receiver and sfu/buffer refactor ([#​4221](livekit/livekit#4221), [#​4224](livekit/livekit#4224), [#​4225](livekit/livekit#4225)) - Change some logs to debugw ([#​4229](livekit/livekit#4229)) - Changing field naming of data track packet ([#​4235](livekit/livekit#4235)) - Update Pion transport package. ([#​4237](livekit/livekit#4237)) - Wrapping the invalid request errors for CreateSipParticipant ([#​4239](livekit/livekit#4239)) ##### Fixed - Swap result sink atomically rather than closing and setting ([#​4216](livekit/livekit#4216)) - Address crash in v1.9.10 ([#​4219](livekit/livekit#4219), [#​4220](livekit/livekit#4220)) - Return on SDP fragment read error. ([#​4228](livekit/livekit#4228)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL21pbm9yIl19--> Reviewed-on: https://git.erwanleboucher.dev/eleboucher/homelab/pulls/484
…g logging
Fix critical agent recording issues: layer init, downtrack race, debug logging
This commit applies three critical fixes for reliable agent recording from publisher tracks using manual subscription and explicit video quality requests.
Issue 1: Fix spatial layer initialization in Forwarder
Problem:
SetMaxSpatialLayer()correctly updated the max spatial layer but failed to initialize target and current layers when they were still set toInvalidLayerSpatial. This caused video forwarding to fail silently.Impact: Agents using manual subscription with explicit video quality requests (
SetVideoQuality) received 0 video packets despite successful subscription. Audio worked fine (separate code path), only video was affected.Fix: Initialize target and current spatial layers when max is set and they remain invalid.
File:
pkg/sfu/forwarder.goIssue 2: Fix WrappedReceiver downtrack race condition
Problem: When downtracks were added before the underlying
TrackReceiverwas ready (stillnil), they were silently lost. This race condition occurred when agents subscribed immediately after track publication.Impact: Recording agents and other clients subscribing quickly after track publish received no packets. The race window was small but reproducible in automated testing scenarios.
Fix: Queue downtracks in a pending list until receiver is ready, then flush the queue atomically.
File:
pkg/rtc/wrappedreceiver.goIssue 3: Add debug logging to RTP forwarding pipeline
Problem: Zero visibility into RTP packet forwarding made it nearly impossible to diagnose why clients weren't receiving packets. Issues #1 and #2 took hours to identify without logging.
Impact: Silent failures in video forwarding had no diagnostic information. Developers had to modify server code and rebuild to debug packet flow issues.
Fix: Add debug logging for the first 10 H.264 video packets showing:
File:
pkg/sfu/receiver.goCombined Impact
These three issues created a "perfect storm" failure mode where:
Affected Scenarios:
SetVideoQuality()immediately after subscriptionUnaffected Scenarios:
Why These Bugs Weren't Caught Earlier
The Python agents SDK uses
auto_subscribe=trueby default, which triggers a different subscription code path that avoids all three issues. These bugs specifically affect:auto_subscribe=false)SetVideoQuality)Testing Validation
✅ Recording agents receive video packets immediately after subscription
✅ Multi-hour recordings complete without packet loss
✅ Immediate subscription after track publish works reliably
✅ Debug logs provide clear visibility into packet flow
✅ No regressions in standard participant subscriptions (verified)
✅ Works with both H.264 and VP8 video codecs