fix(coordinator): restart the whole transcoder subprocess on any config change#34
Merged
Merged
Conversation
…ig change
The native transcoder subprocess owns every rendition — there is no
per-profile lifecycle. But Update routed non-topology transcoder changes
(audio, global, decoder, or a per-profile video update / add / remove)
through a per-profile reload that called StartProfile / StopProfile, which
the subprocess rejects. Every such live update failed with a 500
("per-profile start is not supported"); only a full stream restart applied
the change.
Route any transcoder change that needs the subprocess to the full reload
(reloadTranscoderFull) — the path the package already documented — and
retire the dead per-profile API (reloadProfiles, StartProfile / StopProfile,
ErrNotImplemented). Inputs are now applied before the reload so a combined
input+transcoder change is not skipped. Tests updated to the full-reload
contract, with an audio-change regression added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changing a transcoder config on a running stream (audio sample-rate/bitrate, global GOP/fps, decoder, or a per-profile video update / add / remove) failed with HTTP 500 —
coordinator: reload profiles: ... per-profile start is not supported; the subprocess owns all renditions. Only a full stream restart applied the change.Root cause
The native transcoder runs one subprocess that owns every rendition (a single decode fans out to all encoders) — there is no per-profile lifecycle. But
Coordinator.Updaterouted any non-topology transcoder change through a per-profile reload that calledStartProfile/StopProfile, which the subprocess rejects withErrNotImplemented. The package doc already stated the intended behaviour ("a ladder change restarts the whole subprocess"), but the wiring contradicted it.Fix
reloadTranscoderFull(rebuilds buffers + transcoder + publisher + DVR), the documented path. Inputs are applied before the reload so a combined input+transcoder change is not skipped.reloadProfiles,abrMetaFromUpdated,reloadDVRIfBufferChanged, andtranscoder.StartProfile/StopProfile/ErrNotImplemented.Tests
TestUpdate_AudioChanged_FullReload(regression for the reported bug).go build,go vet,gofumpt,golangci-lint run ./...→ clean;go test ./...passes (only the pre-existing MediaMTX docker integration test is unrelated/flaky).Trade-off
A transcoder config change is now a clean full reload (brief output re-init for all protocols) instead of the impossible per-profile reload — the same effect as
POST /streams/{code}/restart. A lighter subprocess-only restart is possible later but has init-segment/discontinuity subtleties.