api/ffmpeg: move stream type + url count check to remux()

& fix it cuz i broke it in last commit
This commit is contained in:
wukko 2025-06-25 19:57:23 +06:00
parent 52695cbd0f
commit 3dae5b2eb0
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -64,12 +64,6 @@ const render = async (res, streamInfo, ffargs, estimateMultiplier) => {
);
try {
// if the streamInfo.urls is an array but doesn't have 2 urls,
// then something went wrong
if (urls.length !== 2) {
return shutdown();
}
const args = [
'-loglevel', '-8',
...ffargs,
@ -107,6 +101,11 @@ const remux = async (streamInfo, res) => {
const urls = Array.isArray(streamInfo.urls) ? streamInfo.urls : [streamInfo.urls];
const args = urls.flatMap(url => ['-i', url]);
// if the stream type is merge, we expect two URLs
if (streamInfo.type === 'merge' && urls.length !== 2) {
return closeResponse(res);
}
if (streamInfo.subtitles) {
args.push(
'-i', streamInfo.subtitles,