Commit Graph

20 Commits

Author SHA1 Message Date
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
a26c48304a Add support for RTP stream restart. (#4161)
* Add support for RTP stream restart.

When an unhandled packet is encountered, try a restart sequence.
Restart happens when 5 packets with contiguous sequence numbers and same
or increasing time stamps are received. Note that this does not work for
B-frame type of scenarios, but that is true for receive path handling
even before this. As WebRTC does not use B-frames, it is fine. But,
needs to be looked at again if B-frames are necessary.

It is controlled by a config that is disabled by default.

* clean up

* debug log
2025-12-16 13:21:39 +05:30
Raja Subramanian
bfba6feed4 Adjust stream allocator ping interval based on state. (#3951)
* Adjust stream allocator ping interval based on state.

In steady state, does a 15 second ping.
While deficient, to be able to react to probes faster, it pings at 100ms
interval.

* clean up

* log ops queue not able to wake up
2025-09-24 14:45:57 +05:30
Raja Subramanian
3837006b39 Revert "Switch ops queue a singly linked list. (#3949)" (#3950)
This reverts commit 80b1166292.
2025-09-24 14:10:01 +05:30
Raja Subramanian
80b1166292 Switch ops queue a singly linked list. (#3949)
Seeing a good chunk of CPU in deque usage in some profiles.
2025-09-24 13:13:00 +05:30
Raja Subramanian
c8b644934f Update deque and friends. (#3276) 2024-12-20 07:16:14 +05:30
Paul Wells
c4354575ec do not capture pointers in ops queue closures (#2675) 2024-04-22 11:33:28 -07:00
Paul Wells
680a07e896 update pion deps (#2667)
* update pion deps

* deps
2024-04-19 19:21:55 -07:00
Paul Wells
0974f3d961 replace keyframe ticker with timer (#2661) 2024-04-17 22:14:17 -07:00
Paul Wells
5c38d58987 add typed ops queue (#2655)
* add typed ops queue

* tidy
2024-04-16 02:51:49 -07:00
Raja Subramanian
14321f21bf Make OpsQueueParams to make it easier to understand args. (#2578) 2024-03-14 10:27:24 +05:30
Raja Subramanian
e7dd03181c Use smaller default deque size. (#2488) 2024-02-17 21:30:19 +05:30
Raja Subramanian
2f9ec2117f Do not enqueue after stop. (#2457)
Else, that could leak as the process routine may have exited and the
entries are not processed anywhere.
2024-02-06 19:01:24 +05:30
Raja Subramanian
b71d373f4a Use Deque in ops queue. (#2418)
* Use Seque in ops queue.

Standardizing some uses
- Change OpsQueue to use Deque so that it can grow/shrink as necessary and
  need not worry about channel getting full and dropping events.
- Change StreamAllocator and TelemetryService to use OpsQueue so that
  they also need not worry about channel size and overflows.

* Address feedback

* delete obvious comment

* clean up
2024-01-28 13:48:30 +05:30
David Zhao
981fb7cac7 Adding license notices (#1913)
* Adding license notices

* remove from config
2023-07-27 16:43:19 -07:00
Raja Subramanian
d38566850a Do not post close callback in ops queue if not started. (#649)
* Do not post close callback in ops queue if not started.

Ops queue is started in `Bind()`. If `Close()` is called
when bind did not happen (because the underlying peer connection
closed before bind), the close callback does not run.

Check if ops queue is running before posting close callback
into the queue.

Not pretty, but covers this case. Need to think about it more.

* correct check
2022-04-24 11:40:22 +05:30
Raja Subramanian
e138ef3f55 Use error level to get some back trace (#625) 2022-04-19 13:06:47 +05:30
Raja Subramanian
a98d955284 Delta stats throughout (#615)
* Use delta stats throughout and avoid calculating deltas in telemetry

* Fix a few things after testing

* Remove debug

* Fix tests

* delete instead of setting to nil

* Point to the latest protocol
2022-04-16 21:11:32 +05:30
Raja Subramanian
c743d2ab3a Warn on ops queue full (#481)
Pass logger so that we can log with proper context.
2022-03-02 19:08:07 +05:30
Raja Subramanian
2959eebca8 Introducing OpsQueue (#463)
* Introducing OpsQueue

Creating a PR to get feedback on standardizing on this concept.

Can be used for callbacks.
Already a couple of places use this construct. Wondering if we
should standardize on this across the board.
Just changing one place to use the new struct. Another place
that I know of which uses this pattern is the telemetry package.

* atomic flag -> bool
2022-02-25 11:56:26 +05:30