From 4edeb9f63f7d8c7bb3474d2ce8050c4a485b78f0 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 21 Jul 2016 13:23:18 +0200 Subject: [PATCH] Prevent FLV recordings from overwriting with empty files --- src/output/output_progressive_flv.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/output/output_progressive_flv.cpp b/src/output/output_progressive_flv.cpp index dd8bfcad..12c395db 100644 --- a/src/output/output_progressive_flv.cpp +++ b/src/output/output_progressive_flv.cpp @@ -3,6 +3,7 @@ namespace Mist { OutProgressiveFLV::OutProgressiveFLV(Socket::Connection & conn) : HTTPOutput(conn){ if (config->getString("target").size()){ + initialize(); if (!streamName.size()){ WARN_MSG("Recording unconnected FLV output to file! Cancelled."); conn.close(); @@ -14,13 +15,18 @@ namespace Mist { INFO_MSG("Outputting %s to stdout in FLV format", streamName.c_str()); return; } + if (!myMeta.tracks.size()){ + INFO_MSG("Stream not available - aborting"); + conn.close(); + return; + } if (connectToFile(config->getString("target"))){ parseData = true; wantRequest = false; INFO_MSG("Recording %s to %s in FLV format", streamName.c_str(), config->getString("target").c_str()); - }else{ - conn.close(); + return; } + conn.close(); } }