Skip to content

rust: Port media-io/media-remux.c.h to obs-media-io #1927

Closed

Description

@zackees

Unit

libobs/media-io/media-remux.c.h, all of it, into rust/obs-media-io. About 315 lines. Unit 7 of #1846. It is the remux job behind Tools > Remux Recordings: it copies every stream of a recording into another container without re-encoding, keeps audio frames sample accurate (#360), and reports progress.

  • media_remux_job_create
  • media_remux_job_process
  • media_remux_job_destroy

Phase and position

Phase 5/6 (media-io). The file is its own include in the FFmpeg-backed libobs.media unity group, so it can leave the production build whole by moving to a ported group. No open port touches it.

Dependencies and existing tests

media_remux_job_t is opaque in media-io/media-remux.h, so there is no public struct layout. FFmpeg's struct layouts (AVFormatContext, AVStream, AVCodecParameters, AVPacket) differ between FFmpeg versions, so they stay in C: a private adapter media-io/media-remux-ffmpeg.c.h (hidden obs_media_remux_*, in the libobs.media group) makes one libavformat call or reads/writes one field per function, and the Rust job decides every call in the C's order. No Rust crate links FFmpeg.

test_remux_audio_timestamps covers the audio timestamps against real FFmpeg. Nothing covers refused jobs, progress, or channel layouts, so a characterization test comes first.

Covers the _MSC_VER stat/_stat64 conditional of #870 for this file: the Rust port reads the size with os_get_file_size.

Plan

One PR, as #1846 asks:

  1. Characterization: test/cmocka/test_media_remux.c, with WAV inputs written byte by byte (no encoder): refused jobs (no job pointer, missing input, same file, unreadable input, unknown output format, missing output directory), NULL job, every sample kept, 5 channels written as 4.1, 6 as 5.1, progress from 0 to 100, a callback that stops the remux (characterized, not endorsed: still a success), a muxer that rejects the stream.
  2. RED: Tier 1 in the existing obs-media-io test binary against a todo!() core over a scripted Host.
  3. GREEN: safe core and #[no_mangle] shims; media-remux.c.h moves to a ported group; rust-exports.d/obs-media-io-media_remux.txt.
  4. Tier 3: the original built as oracle_media_remux_job_* against a recording FFmpeg stand-in in the oracle crate (no FFmpeg on the Rust test runners); the Rust shim runs through the real adapter over the same stand-in; proptest over random scripts comparing results, progress reports and the full log of FFmpeg calls and blog lines; one mutation check.
  5. rust/README.md row and a port_comparison bench.

Tier 4 does not apply.

Activity

  1. zackees commented on Oct 23, 2026

    @zackees
    MemberAuthor

    Claiming: #1927 (unit 7 of #1846). Plan: one PR, the five steps in the issue body (characterization test, RED, GREEN, Tier 3 with an FFmpeg stand-in, README and bench). Draft PR expected within a few hours.

  2. added
    claimed
    on Oct 23, 2026
  3. added a commit that references this issue on Oct 23, 2026
    f5b13b0
  4. zackees commented on Oct 23, 2026

    @zackees
    MemberAuthor

    Fixed by #1928: media_remux_job_* now come from obs-media-io; FFmpeg struct access stays in the private C adapter media-io/media-remux-ffmpeg.c.h. Intentional differences are listed in the PR and in rust/README.md. Nothing left for this unit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions