Commit Graph
8 Commits
Author SHA1 Message Date
Jash 040bd411b4 fix: pause on a zero VARPLAY rate and treat a zero rate parameter as normal speed refs #5936 2026-11-15 11:32:55 -05:00
Jash a4869e1b4e fix: stop zms crashing on a scale that gives an invalid image size fixes #5633 2026-11-13 09:16:50 +05:30
Isaac ConnorandClaude Opus 5.5 643296bf07 fix: keep the zoom crop when playback moves to a different resolution refs #4186
prepareImage keeps last_crop in the pixels of the frame it was computed for.
When event playback moves to a monitor with another resolution, the old crop
was applied to the new frame, so the zoomed area jumped or Crop refused it.
Record the frame size the crop belongs to and rescale the crop when it changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:30:56 -05:00
Nic BoetandClaude Opus 4.8 1d6dcff83b fix: name zms command sockets after the user the stream serves refs GHSA-7hhq-xw65-4crf
ajax/stream.php sends stream commands (query, pause, seek, zoom, quit)
to the zms whose unix socket matches a connkey, with no permission
check. Connkeys are six random digits chosen when the stream starts,
so any logged-in user who guessed or saw one could read the status of
another user's stream, of a monitor they may not view included, and
pause or end it. A second zms started with the same connkey also waited
on the first one's lock and then took over its socket.

zms already authenticates the user and checks their access to the
monitor or event before it streams. Keep that user's id and put it in
the lock, command socket and reply socket names
(zms-<connkey>-<user id>s.sock); stream.php builds the names from the
caller's own id through zmsSocketPath(), so a request reaches only the
caller's streams. Without authentication the id is 0 on both sides.

Adds a StreamBase test in tests/zm_stream.cpp and
tests/php/test_zms_socket_path.php, which pin the same names. The
existing command-socket-teardown test is updated for the owner-suffixed
names (it postdates the reporter's base commit).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-31 11:11:01 -04:00
Isaac ConnorandClaude Opus 5.5 42c37cdcbb fix: close the zms command socket as soon as the command thread stops
The command socket stayed bound until ~StreamBase(), which runs only after
the stream thread has finished. A zms that was shutting down but still busy
in the stream thread (blocked writing to a client that had gone away, for
instance) kept accepting commands it would never read. web/ajax/stream.php
then waited out its whole MSG_TIMEOUT on each one and logged "Timed out
waiting for msg ... after waiting 5000 milliseconds", where a missing socket
would have been reported as no_socket at once.

Call closeComms() when checkCommandQueue() leaves its loop. sd is only used
from the command thread, and closeComms() clears sd and lock_fd, so the
destructor's later call does nothing and cannot remove a socket bound by a
successor zms on the same connkey.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 17:12:27 -04:00
Jash 5e0d6afaf4 fix: send pre-scaled frames as built when scale or zoom changes refs #3681 2026-08-26 18:22:39 +05:30
Jash e48ae03275 perf: scale during colour conversion in zms playback fixes #3681 2026-08-26 11:15:19 +05:30
Isaac ConnorandClaude Opus 5 403b1cd982 fix: initialise StreamBase::lock_fd to -1 refs #5029
lock_fd was initialised to 0, but every other use in the class treats a
negative value as "no lock held": openComms() sets it to -1 when open() or
flock() fails, and closeComms() guards on `lock_fd >= 0` before closing.

The constructor's 0 passes that guard, so a StreamBase destructed without
openComms() having succeeded calls close(0) and closes stdin. Reaching it only
takes connkey > 0 plus a runStream() that returns before openComms(), and
MonitorStream::runStream() has two such returns: the STREAM_SINGLE branch and
the !monitor branch. mode=single URLs still carry a connkey, so both are
reachable in normal operation.

zms exits shortly afterwards and does little in between, so the practical
impact today is small. It is still closing a descriptor the class does not own,
and once fd 0 is free the next open() in the process silently lands on it.

Add a regression test covering destruction with and without a connkey. It saves
and restores fd 0 so a failure can't cascade into the rest of the suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 08:03:13 -04:00