Commit Graph

2509 Commits

Author SHA1 Message Date
cnderrauber
148a2af151 Log when dropping data packet by slow reader (#3429) 2025-02-13 15:26:22 +08:00
cnderrauber
7e4df818ee Fix timing issue between track republish (#3428) 2025-02-13 13:59:03 +08:00
Raja Subramanian
f160f6200a Do not log no packets in delta. (#3427)
Can happen a lot with dynacast layer turn off.
2025-02-13 11:25:57 +05:30
Raja Subramanian
1c3c70a136 Check for nil in sender view stats. (#3426)
Seeing some panic due to sender view being nil. It is possible to have
nil sender view and not-nil receiver view. For analytics, only sender
view is used. Handle nil properly.
2025-02-13 10:55:23 +05:30
Raja Subramanian
1ae2e48c2e Webhook analytics event. (#3423)
* Webhook analytics event.

* deps

* generate

* nil notifier
2025-02-13 10:39:45 +05:30
Raja Subramanian
7fef374b19 Split down stream snapshot into sender view and receiver view. (#3422)
Receiver view is used for connection quality.

Sender view is used for analytics. One thing that this introduces is
that sender view uses the packet loss information from receiver view as
true loss is available only in the RTCP Receiver Reports received from
the remote side. So, the time alignment is off, i. e. receiver report
happens periodically and it includes information till the time at which
it was sent from remote side, but sender could have sent more packets
after that time.

The split should ensure that analytics does not rely on remote side
sending proper receiver repoerts albeit at slight misalignment of loss
statistic for remotes that send RTCP RR (which should be majority of the
cases)
2025-02-11 16:05:00 +05:30
Raja Subramanian
5e1431f433 Do not use separate struct field for mime. (#3421) 2025-02-11 12:08:02 +05:30
cnderrauber
4b709d3d88 Fix codec match in downtrack (#3420) 2025-02-11 11:45:22 +08:00
Raja Subramanian
65d30d9e43 Ignore unknown mime in dynacast manager. (#3419)
Actually, was caused by down track not initialising mime, but it is good
to ignore unknown mime.

Also, added ulpfec sa SDP has that and there was a conversion which was
returning unknown. Also, note that the mime types use audio for RED and
video for flexfec and ulpfec although they are not media type dependent.
Maybe, at point need to introduce `MimeTypeAudioRED` and
`MimeTypeVideoRED`.
2025-02-10 14:56:52 +05:30
Raja Subramanian
3da7de76c7 Fix sense of codec match check while setting layer SSRC. (#3418) 2025-02-10 13:40:16 +05:30
Raja Subramanian
9551c52c85 Try 2 to consolidate mime type (#3407)
* Normalize mime type and add utilities.

An attempt to normalize mime type and avoid string compares remembering
to do case insensitive search.

Not the best solution. Open to ideas. But, define our own mime types
(just in case Pion changes things and Pion also does not have red mime
type defined which should be easy to add though) and tried to use it everywhere.
But, as we get a bunch of callbacks and info from Pion, needed conversion in
more places than I anticipated. And also makes it necessary to carry
that cognitive load of what comes from Pion and needing to process it
properly.

* more locations

* test

* Paul feedback

* MimeType type

* more consolidation

* Remove unused

* test

* test

* mime type as int

* use string method

* Pass error details and timeouts. (#3402)

* go mod tidy (#3408)

* Rename CHANGELOG to CHANGELOG.md (#3391)

Enables markdown features in this otherwise already markdown'ish formatted document

* Update config.go to properly process bool env vars (#3382)

Fixes issue https://github.com/livekit/livekit/issues/3381

* fix(deps): update go deps (#3341)

Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Use a Twirp server hook to send API call details to telemetry. (#3401)

* Use a Twirp server hook to send API call details to telemetry.

* mage generate and clean up

* Add project_id

* deps

* - Redact requests
- Do not store responses
- Extract top level fields room_name, room_id, participant_identity,
  participant_id, track_id as appropriate
- Store status as int

* deps

* Update pkg/sfu/mime/mimetype.go

* Fix prefer codec test

* handle down track mime changes

---------

Co-authored-by: Denys Smirnov <dennwc@pm.me>
Co-authored-by: Philzen <Philzen@users.noreply.github.com>
Co-authored-by: Pablo Fuente Pérez <pablofuenteperez@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Paul Wells <paulwe@gmail.com>
Co-authored-by: cnderrauber <zengjie9004@gmail.com>
2025-02-10 10:44:15 +05:30
Raja Subramanian
045bd785a9 Record number of elements, keys size and values sizes separately. (#3415) 2025-02-08 13:12:48 +05:30
Raja Subramanian
99afbf587b Use a Twirp server hook to send API call details to telemetry. (#3401)
* Use a Twirp server hook to send API call details to telemetry.

* mage generate and clean up

* Add project_id

* deps

* - Redact requests
- Do not store responses
- Extract top level fields room_name, room_id, participant_identity,
  participant_id, track_id as appropriate
- Store status as int

* deps
2025-02-07 16:16:41 +05:30
Pablo Fuente Pérez
b88de555bf Update config.go to properly process bool env vars (#3382)
Fixes issue https://github.com/livekit/livekit/issues/3381
2025-02-06 18:02:21 -06:00
Denys Smirnov
ccbc988824 Pass error details and timeouts. (#3402) 2025-02-06 13:53:44 +02:00
Paul Wells
d8e325d3d4 copy track info when toggling mute (#3406)
* copy track info when toggling mute

* test
2025-02-05 20:12:11 -08:00
cnderrauber
aeec75edeb H265 supoort and codec regression (#3358)
* H265 supoort and codec regression

Support H265 codec.
Add optional codec regression for subscribers don't
support advanced codecs like H265, AV1, VP9.

* restart forwarder on upstream codec change

* tests

* Reneogitate new codec if client doesn't support change

* Add option to disable codec regression

---------

Co-authored-by: boks1971 <raja.gobi@tutanota.com>
2025-02-06 11:56:49 +08:00
Raja Subramanian
abcaa9b8ab Fix /etc/validate route (#3403) 2025-02-05 23:20:20 +05:30
Raja Subramanian
14e65f1459 AnalyticsEvent for generic reports (#3400)
* AnalyticsEvent for generic reports

* deps
2025-02-05 10:13:43 +05:30
Raja Subramanian
bb0ee1139c Drive-by misc changes. (#3399)
While working on a different service, noticed delegation of setting up
routes to the service itself. So, making that change and making some
methods internal only as there is no need to export them outside the
service.
2025-02-04 12:32:05 +05:30
Raja Subramanian
7ff4082e4a Do not skip due to large RR interval. (#3398)
* Do not skip due to large RR interval.

With sequence number adjustment, it will report some packets missing
which is fine.

* do not seed if already initialized
2025-02-04 11:08:38 +05:30
Raja Subramanian
f45e3613ac Correct reason for poor/lost score. (#3397)
No functional change, just logging reason was confusing.
Also, log no packets case. Seeing some instances in staging where there
are periods of no packets received. Trying to understand better.
2025-02-04 00:59:56 +05:30
Raja Subramanian
2f758d49ce Adjust receiver report sequence number to be within range of highest. (#3396) 2025-02-03 21:58:26 +05:30
Raja Subramanian
91728fa59b More defensive checks for mime. (#3394) 2025-02-03 12:07:12 +05:30
Raja Subramanian
92e3f2e3d0 Starting on padding for RTX stream is accepted. (#3390) 2025-02-02 20:26:30 +05:30
Raja Subramanian
20b400faef Use signed check on rollback. (#3389) 2025-02-01 14:16:53 +05:30
Raja Subramanian
adc2246353 Move sequence number adjustment to when out-of-order is detected (#3387)
initially.

Out-of-order reception is detected and dropped before this change. By
moving the adjustment to that point, potentially more reports can be
processed.
2025-01-31 11:56:48 +05:30
Paul Wells
7216c825fb fix internal signal protocol backward compatibility with 1.7.x (#3384)
* fix internal signal protocol backward compatibility with 1.7.x
fixes #3371

* tidy
2025-01-30 16:44:35 -08:00
David Zhao
1825ea81f0 fire TrackSubscribed event only when subscriber is visible (#3378)
TrackSubscribed is meant to give publishers an indication when the subscriber
is ready to receive its audio. When there are hidden recorders in the room,
we do not want them to trigger this event.
2025-01-30 10:48:52 -06:00
Paul Wells
3970e965f6 move ConnectedAt to Participant interface (#3383) 2025-01-30 05:45:47 -08:00
Raja Subramanian
a4ccc7cc7f Run bandwidth estimation when congestion is relieved also (#3380) 2025-01-30 11:57:58 +05:30
Raja Subramanian
c90473b749 ReconnectResponse getting mutated due to mutation of client conf. (#3379) 2025-01-30 11:23:23 +05:30
Raja Subramanian
5aa17adc91 Clone TrackInfo to TrackPublishRequested event. (#3377)
This is atleast one place where analytics objects are getting mutated.
2025-01-29 14:10:43 +05:30
Raja Subramanian
1b86b485a9 Fix (hopefully) state transition. (#3375)
My previous PR was trying to fix a premature transition from CONGESTED -> NONE state.
But, that introduced a bug which accelerated the transition from EARLY_WARNING -> CONGESTED state due to holding the `queuingRegion` state variable.

Fix by not holding `queuingRegion` in state and take result of
processing runs.

NOTE: This can still use some work to make the state machine cleaner.
Initially, I was passing around a bunch of variables which was uncouth.
Then moved things to state which made code easier to read and also log
different things, but it causes problems like the ones above. Will take
another look and think more about making it more robust.
2025-01-29 01:00:53 +05:30
Raja Subramanian
59be7c601b Declare congestion none only if both methods are in DQR. (#3372)
* Declare congestion none only if both emthods are in DQR.

* do not change congestion reason unless queuing region changes
2025-01-28 14:10:23 +05:30
Raja Subramanian
c30204d56c Fix typo in SendData nonce length check. (#3370)
Definitely need new glasses :-(
2025-01-28 09:59:48 +05:30
Raja Subramanian
2b5ee12f9b Reduce chances of metadata cache overflow. (#3369) 2025-01-27 18:14:57 +05:30
Raja Subramanian
db75092aa6 Use nonce in data messages to de-dupe SendData API. (#3366)
* Use nonce in data messages to de-dupe SendData API.

With API retries, it is possible that some data messages are sent
multiple times. Check the nonce (if present) to de-dupe data messages
before forwarding it to the clients.

* add nonce to UserPacket

* defer unlock

* 128-bit UUID as nonce

* - UUID nonce
- make a UserPacketDeduper module for easier re-use.

* deps

* feedback
2025-01-27 15:35:37 +05:30
David Zhao
30669722c3 fix: pass RoomConfig along when creating a new dispatch rule (#3367) 2025-01-26 23:36:42 -06:00
Paul Wells
ef4b5faba1 close signal session is request messages are undeliverable (#3364) 2025-01-24 00:24:22 -08:00
Raja Subramanian
524441446f Room creation time with ms resolution (#3362) 2025-01-23 09:42:30 +05:30
Paul Wells
f435c5cb62 reduce log level for channel closed error when writing signal message (#3361)
* reduce log level for channel closed error when writing signal message

* tidy
2025-01-22 04:33:47 -08:00
Raja Subramanian
b4cf055c1c Resolve newer participant using higher precision join time. (#3360)
* Resolve newer participant using higher precision join time.

Also, keep it consistent based on participant SID if everything else is
the same.

* switch to compare semantics

* fix
2025-01-22 15:24:34 +05:30
Raja Subramanian
416dded86f Clone pending tracks to prevent concurrent update. (#3359) 2025-01-22 13:24:26 +05:30
Raja Subramanian
0c28e432a3 Log RTT as seen by congestion controller (#3354) 2025-01-22 00:08:11 +05:30
Raja Subramanian
7a7e312424 Log probes. (#3352) 2025-01-21 20:51:03 +05:30
Raja Subramanian
bea907b3a0 Request key frame on subscription change. (#3349)
To assist the path where the requested layer is higher than current seen
maximum and there is no congestion.
2025-01-20 18:45:05 +05:30
Raja Subramanian
35bb36e5fb Request key frame if subscribed is higher than max seen and not (#3348)
congested.
2025-01-20 16:40:52 +05:30
Raja Subramanian
fe94a18bc2 Do not seed if stream is already writable. (#3347)
* Do not seed if stream is already writable.

It is possible that in migration case, when the forwarder state is
fetched from migrating out node and used to seed downtrack, it has
already started due to the time it takes to get the state. Seeding in
that state will reset things and cause large sequence number gaps
potentially.

* do not take lock
2025-01-20 11:08:59 +05:30
Paul Wells
759e5f79e0 allocate node for autocreated room in agent dispatch (#3344) 2025-01-17 00:54:30 -08:00