Patch LibavDemuxer to output full error stack trace for stream failures
This commit is contained in:
parent
4ccb769c9d
commit
072d0483bd
1 changed files with 19 additions and 0 deletions
|
|
@ -12,6 +12,25 @@ try {
|
|||
// Optional in local dev when dependencies are not installed yet.
|
||||
}
|
||||
|
||||
try {
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const targetPath = path.resolve(__dirname, "node_modules/@dank074/discord-video-stream/dist/media/LibavDemuxer.js");
|
||||
if (fs.existsSync(targetPath)) {
|
||||
let content = fs.readFileSync(targetPath, "utf8");
|
||||
if (!content.includes("DEMUX ERROR STACK")) {
|
||||
content = content.replace(
|
||||
`loggerFrameCommon.info({ error: e }, "Received an error during frame extraction. Stopping");`,
|
||||
`console.error("[DEMUX ERROR STACK]:", e && e.stack ? e.stack : e); loggerFrameCommon.info({ error: e }, "Received an error during frame extraction. Stopping");`
|
||||
);
|
||||
fs.writeFileSync(targetPath, content, "utf8");
|
||||
console.log("[worker] Patched LibavDemuxer.js successfully to print demux error stack.");
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("[worker] Failed to patch LibavDemuxer.js:", err);
|
||||
}
|
||||
|
||||
const PORT = Number(process.env.PORT || "8790");
|
||||
const TOKEN = String(process.env.WATCHPARTY_WORKER_TOKEN || "").trim();
|
||||
const DISCORD_USER_TOKEN = String(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue