Commit Graph

1176 Commits

Author SHA1 Message Date
Raja Subramanian 7eaaaada5d Mark last run of grow bucket outside goroutine. (#4348)
* straem tracker debug logging

* tracker

* debug

* clean up
2026-03-06 19:36:13 +05:30
Raja Subramanian 52c28a938d Log a bit more details of out-of-order TWCC feedback report. (#4343)
* Log a bit more details of out-of-order TWCC feedback report.

* Revert to mono.Now()
2026-03-05 11:55:13 +05:30
Raja Subramanian bab9186840 do not discount packets lost on duplicate packets (#4333) 2026-02-23 23:55:56 +05:30
Raja Subramanian 939794cf47 mark + restart (#4329) 2026-02-21 15:12:13 +05:30
Raja Subramanian 75f9c462be Add debug for receiver restart. (#4328)
* Add debug for receiver restart.

Have a suspicion that something is deadlocking between restart receiver
and buffer bind during replay. Adding debug to get a better picture of
state of receiver restart.

* consistent logging
2026-02-20 01:44:59 +05:30
Raja Subramanian 74891f30fe Protect against incorrect temporal layer. (#4327)
Seeing some tracks with temporal layer higher than array bounds.
Protect against it and log some info to understand better.
2026-02-19 23:57:58 +05:30
Raja Subramanian 35d7ef88c2 Avoid alloc in RTPStatsReceiver.Update (#4302)
Using a pointer to the logging context was doing allocations.
2026-02-09 11:53:17 +05:30
Raja Subramanian bb744916fd More optimisation in RTPStats module. (#4298)
Was hoping for more hidden bits to optimise, but oh well.
2026-02-06 21:33:41 +05:30
Raja Subramanian cefd5da940 Optimise some bits in rtpstats_receiver (#4297)
* Optimise some bits in rtpstats_receiver

RTPStatsReceiver.Update is one of the high CPU bits. Taking some
suggestions from Cursor. Makes the `Update` function verbose though :-(

* zap.Inline logging fields

* rename
2026-02-06 21:26:30 +05:30
Raja Subramanian 370e0a4d52 Set up audio config in audio level module when config is updated. (#4290)
* Set up audio config in audio level module when config is updated.

It is possible to get audio config after bind (bind is where the audio
level module is created) for remote tracks. So, split out setting audio
level config in audio level module and invoke it when config is updated.

* coderabbit review

* prevent divide-by-0

* not active before config
2026-02-05 09:35:26 +05:30
Raja Subramanian f3e9b68854 Do not increase max expected layer on track info update. (#4285)
* Do not increase max expected layer on track info update.

When max expected layer increases, the corresponding trackers are reset
so that first packets from those layers can trigger a layer detected
change enabling quick detection of layer start.

A track info update changing max to what is in track info could set the
max expected to be higher without resetting the tracker. And that would
cause dynacast induced max layer change to miss tracker reset too.

Sequence
- dynacast sets max expected to 0
- track info update sets it to 2
- dynacast sets it to 1 --> this should have reset tracker on layer 1,
  but because it is less than current max (2), it is skipped.

* thank you CodeRabbit

* force update on start
2026-02-04 12:19:41 +05:30
Raja Subramanian a9849340c3 Avoid logger data race. (#4284)
Also defer promise channel close.
2026-02-04 01:35:44 +05:30
Raja Subramanian 9701662757 Do not hold lock when creating buffer (#4283)
* create buffer outside lock

* more debug

* initialize on new buffer

* clean up

* address CodeRabbit catch
2026-02-04 00:55:49 +05:30
Raja Subramanian 6b68e3d536 Create buffer if needed when a PLI is requested. (#4282)
Useful across relay where a PLI may be requested before a buffer exists and
needs to be created.
2026-02-03 18:34:38 +05:30
Raja Subramanian 1e689e1a24 Reducing some info level logs. (#4274)
* Reducing some info level logs.

Also, relaxing the check for runaway RTCP receiver report to allow for
rollover to catch up if it is not too far away.

* set logger
2026-02-02 10:54:03 +05:30
cnderrauber 01bd966ff8 Add silent frame for pcmu/a (#4258)
* Add silent frame for pcmu/a

* use red

* solve comment
2026-01-21 16:11:08 +08:00
Anunay Maheshwari 0c33b8c671 chore: move codecs/mime stuff to protocol (#4255) 2026-01-20 20:54:32 +05:30
Raja Subramanian aea044c5cb Defer setting clock rate in RTPStats module till codec is bound. (#4250)
With audio simulcast codecs, it is possible that the clock rate of the
primary codec is different from the secondary codec. If a subscriber
binds to the secondary codec, the clock rate should be set correctly. Do
it at bind time.
2026-01-15 22:08:50 +05:30
Raja Subramanian d9f716c14a FIx receiver restart race (#4248) 2026-01-15 19:54:20 +05:30
Denys Smirnov 843d8c3ea1 Update Pion transport package. (#4237)
* Update Pion transport package.

* Update mediatransportutil package.
2026-01-13 19:56:41 +02:00
Raja Subramanian 7fae5ac9e6 Do not restart receiver on codec change mid-session. (#4225)
* Do not restart receiver on codec change mid-session.

This is not supported and was an erroneous change during the
receiver_base/buffer_base + RTP stream restart consolidation. Also make
the codec munger creation more resilient.

* fix test
2026-01-08 02:35:32 +05:30
Raja Subramanian 0a7dd40b35 Use only layer 0 for SVC codecs. (#4224)
GetOrCreateBuffer was using passed in layer when creating a new buffer.
But, it should always use layer 0 only for SVC.
2026-01-07 18:57:21 +05:30
Raja Subramanian 80ba93fa18 Do NACK updates as soon as flow state is processed. (#4221) 2026-01-06 11:59:21 +05:30
Raja Subramanian 4405afe24d Use atomic pointer and return interface from RED transformer constructors (#4220) 2026-01-06 06:45:52 +05:30
Raja Subramanian b649c2fe95 Remove method not needed from REDTransformer. (#4219)
Also assert that the implementation aligns with the interface.
2026-01-05 11:53:24 +05:30
Raja Subramanian f0080f35b2 Remove enable arrival time forwarding method. (#4217)
Will add it if necessary.
2026-01-03 23:25:44 +05:30
Raja Subramanian 46651c1978 Release v1.9.10 (#4214)
* Release v1.9.10

* move room exists service store op to Added section
2026-01-01 12:36:34 +05:30
Raja Subramanian 08ac4ecdc5 Support preserving external supplied time. (#4212)
In some paths, it is better to preserve pre-recorded time. So, make the
base implementations preserve the RTCP Sender Report receive time.

Also, add a method to enable forwarding packet arrival time. Could be
used across relay.
2025-12-31 14:41:59 +05:30
Raja Subramanian 1a4758ed9c Skip restart callback if external. (#4208)
* Skip restart callback if external.

Without out the external restart was bumping forwarder generation twice.

* fix sense
2025-12-30 22:14:06 +05:30
Raja Subramanian dde4fb498e configurable dependency descriptor restart (#4207)
* configurable dependency descriptor restart

* KeyFrame -> IsKeyFrame

* use the params directly
2025-12-29 23:51:15 +05:30
Raja Subramanian 3606ce542f Do not warn about track not bound if participant is not ready. (#4205)
Analysed half a dozen cases and all of them were due to participant is
not active yet.

Also, some misc logging changes.
2025-12-29 18:16:11 +05:30
Raja Subramanian b8ddd0f98c Taking interface{} -> any modernize bits (#4204) 2025-12-28 05:22:12 +05:30
Raja Subramanian b91cd2e4ea Rework receiver restart. (#4202)
* Rework receiver restart.

- Protect against concurrent restarts
- Clean up and consolidate code around restarts
- Use `RestartStream` of buffer rather than creating new buffers.

* fix test
2025-12-27 17:17:16 +05:30
Raja Subramanian bb00c86489 Restart API on receiver. (#4200)
Can be used when track moves forward/backward.
2025-12-27 03:42:23 +05:30
Raja Subramanian 25ece1e911 Minor refactor in buffer base and audio level (#4198)
* Minor refactor in buffer base and audio level

- Make a function for `restartStream`. Will be useful
  when external signal needs to restart a stream. Also restart all the
  bits (audio level, dd parser and frame rate calculator)
- make an audio level mode with RTP timestamp so that some state can be
  moved out of buffer base

* clean up

* log restart
2025-12-26 20:13:38 +05:30
Raja Subramanian 599002f890 ignore PLI requests for non-video (#4196)
* ignore PLI requests for non-video

* under lock
2025-12-26 12:26:22 +05:30
Raja Subramanian 2510b9462e Taking a bunch of go modernize suggestions. (#4194)
This is not all of it as it is not possible (or at least I do not know
of a way) to get all suggestions for a repo/project. Did this via loop
searching mainly and taking the modernize suggestions.
2025-12-25 16:55:58 +05:30
Raja Subramanian ed8e6afcd7 Handle repair SSRC of simulcast tracks during migration. (#4193)
* Handle repair SSRC of simulcast tracks during migration.

* fix

* fix comment
2025-12-25 14:45:48 +05:30
Raja Subramanian c6bf7a2786 Fix logging key and other clean up around stream restart. (#4192) 2025-12-24 22:48:25 +05:30
Raja Subramanian 8b0efb8c89 Resolve RTX pair via OnTrack also. (#4190)
* Resolve RTX pair via OnTrack also.

In simulcast probing path, the interceptor chain is not invoked
for primary stream. Not sure if this is a recent change. Due to this,
the RTX pair does not get resolved.

Use the onTrack callback to resolve the pair.

* remove debug
2025-12-24 15:27:13 +05:30
Raja Subramanian 381bce03ae Return extended sequence number only and not packet. (#4189)
* Return extended sequence number only and not packet.

Callers need only the extended sequence number.
Extended packet could get release if the forwarder processes it before
caller accesses it causing a data race.

* grow bucket in a go routine
2025-12-24 10:44:56 +05:30
Raja Subramanian 6bcbf54ea1 Always instantiate nacker when using out-of-band sequence numbers. (#4187) 2025-12-24 04:10:11 +05:30
Raja Subramanian e71184dea0 Store buffer after creating it. (#4186)
* Refactor receiver and buffer into Base and higher layer.

To be able to share code/functionality with relay.

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* clean up

* deps

* fix test

* fix test

* Store buffer after creating it.

Also changing signature of creator function as it could call TrackInfo()
and get into a deadlock.

* fix double unlock

* add some more debug logging
2025-12-24 02:55:51 +05:30
Raja Subramanian 7c8ea11505 Refactor receiver and buffer into Base and higher layer. (#4185)
* Refactor receiver and buffer into Base and higher layer.

To be able to share code/functionality with relay.

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* clean up

* deps

* fix test

* fix test
2025-12-23 21:35:48 +05:30
Raja Subramanian 32cd0370c7 Flush the ext packets on restart/close and release packets. (#4179) 2025-12-19 20:25:22 +05:30
Raja Subramanian fb849edc6a Minor clean up (#4172) 2025-12-18 08:46:40 +05:30
Raja Subramanian 47324abd0e Drop run away receiver reports. (#4170) 2025-12-17 21:58:47 +05:30
Paul Wells 462ec324be prevent uint overflow setting packet not found count (#4169) 2025-12-17 06:54:23 -08:00
Raja Subramanian 5c841b8ea1 Some logging changes. (#4168)
* Some logging changes.

Trying to chase a case of large sequence number gap on subscriber side
where packets are sent after a long time.

* return values instead of logging
2025-12-17 18:05:29 +05:30
Paul Wells 2f2d0a5735 skip lost sequence number ranges in getIntervalStats (#4166) 2025-12-17 00:02:51 -08:00