Skip to content

obs-ffmpeg-mux: seek contract, failed-open cleanup, exit status, split argv (split from #1464) - #1553

Merged
zackees merged 3 commits into
masterfrom
fix/ffmpeg-mux-split
Oct 20, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/ffmpeg-mux-split

Conversation

@zackees

@zackees zackees commented Oct 20, 2026

Copy link
Copy Markdown
Member

Split from #1464 (the obs-ffmpeg-mux part).

Fixes in plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c.h:

  • Seek callback (ab56688): ffmpeg_mux_seek_av_buffer returned 0 for every seek. Per the AVIO contract it now returns the new position, strips AVSEEK_FORCE, and returns -1 for AVSEEK_SIZE/SEEK_END and for offsets before 0 or past INT64_MAX.
  • Failed open cleanup (cd07703): when the output file cannot be opened, free_avformat dereferenced the NULL output->pb. It now skips the IO context when it was never allocated.
  • Exit status (eadd067): main returned 0 even after a packet read/write error; it now returns FFM_ERROR.
  • Split recording argv (ce1d1ff): when the next split file failed to open, read_change_file left argv[1] pointing at its own filename buffer; main then freed it (and on Windows freed argv[1] again). argv[1] is restored before the result is checked.

Evidence: new cmocka test test/cmocka/test_ffmpeg_mux_helper.c (registered in tests.d/test_ffmpeg_mux_helper.cmake, Linux) includes ffmpeg-mux.c.h with main renamed and calls the static functions directly: seek positions/rejections, ffmpeg_mux_init_context on an uncreatable path (crashes on master), main fed a truncated packet via stdin (returns 0 on master), and read_change_file failure (argv[1] not restored on master). Commit 1 is RED, commit 2 GREEN. Not built locally (no FFmpeg/cmocka on the shared host); ./lint passes; PR CI Tier 2 is the gate.

Ledger line added to docs/features.md.

… argv (RED)

Split from #1464. Fails on master: the seek callback returns 0, free_avformat
dereferences a NULL pb after a failed open, main returns 0 after a packet
error, and read_change_file leaves argv[1] on its own buffer on failure.
…nd split argv (GREEN)

Split from #1464 (commits ab56688, cd07703, eadd067, ce1d1ff):
- the AVIO seek callback returns the new position and fails unsupported
  whence values (AVSEEK_SIZE, SEEK_END) and out-of-range offsets;
- free_avformat() skips the IO context when it was never allocated;
- main() returns FFM_ERROR after a packet read/write failure;
- read_change_file() restores argv[1] before reporting a failed init.
@zackees
zackees force-pushed the fix/ffmpeg-mux-split branch from 0fbbf50 to 84e5042 Compare October 20, 2026 21:11
@zackees
zackees added this pull request to the merge queue Oct 20, 2026
Merged via the queue into master with commit 1b187b2 Oct 20, 2026
44 of 46 checks passed
@zackees
zackees deleted the fix/ffmpeg-mux-split branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant