From 3cac6d2d1098d9347dc96ab79f98f84f57d358c8 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Mon, 10 Aug 2015 17:55:23 -0700 Subject: [PATCH] Fix ffmpeg fd leak --- lib/ffmpeg.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ffmpeg.js b/lib/ffmpeg.js index 8363f806..37cf49df 100644 --- a/lib/ffmpeg.js +++ b/lib/ffmpeg.js @@ -30,10 +30,12 @@ var audioOnlyContainers = { function fflog() { } function initFFLog() { + if (fflog.initialized) return; var logger = new Logger.Logger(path.resolve(__dirname, "..", "ffmpeg.log")); fflog = function () { logger.log.apply(logger, arguments); }; + fflog.initialized = true; } function testUrl(url, cb, redirCount) { @@ -215,7 +217,7 @@ exports.ffprobe = function ffprobe(filename, cb) { } exports.query = function (filename, cb) { - if (Config.get("ffmpeg.log")) { + if (Config.get("ffmpeg.log") && !fflog.initialized) { initFFLog(); }