Skip to content

Send a partial Object when the live input pauses - #58

Merged
mondain merged 2 commits into
openmoq:mainfrom
gwendalsimon:fix/partial-object-time-bound
Nov 19, 2026
Merged

mondain merged 2 commits into
openmoq:mainfrom
gwendalsimon:fix/partial-object-time-bound

Conversation

@gwendalsimon

@gwendalsimon gwendalsimon commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

When a live input paused, moq2ts kept the packets already read for the next Object and sent them only when the input resumed. Receivers then got those packets one pause late: a 2.5 s pause delayed up to 347 packets by 2.5 s.

moq2ts now sends the partial Object once its first packet has waited 50 ms. It also reads a pipe in chunks of up to 64 KB instead of waiting for 16 KB. Files work as before.

On a slow input, the rule also bounds the time to fill an Object. At 128 kb/s, an Object carries about 4 packets (computed).

I tested the change in November 2026. A new test checks that a quiet pipe and a quiet packet queue each give a partial Object after 50 ms. On a steady pipe, Objects stay full, and the CPU use matches main. All 21 unit tests pass.


This change is Reviewable

gwendalsimon and others added 2 commits November 12, 2026 16:32
readObject waited for a full Object with no time limit. When a live
input stalled, the packets already read waited for it to resume and
reached receivers late, after their playout time.

* Publish the partial Object once its first packet has waited 50 ms
  and no further packet is available.
* Wait with a timeout: poll() on a pipe or FIFO, and a new
  PacketQueueDevice::waitForReadyRead() for a program of a multiplex.
  A regular file never waits.
* Open a source that is not a regular file unbuffered. A buffered
  QFile reads 16 KB at a time, and on a pipe the read waits for all
  of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Opened unbuffered, the pipe cost one read() per 188-octet packet and a
poll() before each. A read now takes what the pipe holds, up to 64 KB,
into the packetizer's own buffer, and poll() runs only while that
buffer holds less than one packet.

* Serve the bytes that open() peeked first, so the order holds.
* Keep a partial trailing packet until the rest arrives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mondain
mondain merged commit 9347650 into openmoq:main Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants