Prevent FLV recordings from overwriting with empty files

This commit is contained in:
Thulinma 2016-07-21 13:23:18 +02:00
parent 13ff0e2904
commit 4edeb9f63f

View file

@ -3,6 +3,7 @@
namespace Mist { namespace Mist {
OutProgressiveFLV::OutProgressiveFLV(Socket::Connection & conn) : HTTPOutput(conn){ OutProgressiveFLV::OutProgressiveFLV(Socket::Connection & conn) : HTTPOutput(conn){
if (config->getString("target").size()){ if (config->getString("target").size()){
initialize();
if (!streamName.size()){ if (!streamName.size()){
WARN_MSG("Recording unconnected FLV output to file! Cancelled."); WARN_MSG("Recording unconnected FLV output to file! Cancelled.");
conn.close(); conn.close();
@ -14,13 +15,18 @@ namespace Mist {
INFO_MSG("Outputting %s to stdout in FLV format", streamName.c_str()); INFO_MSG("Outputting %s to stdout in FLV format", streamName.c_str());
return; return;
} }
if (!myMeta.tracks.size()){
INFO_MSG("Stream not available - aborting");
conn.close();
return;
}
if (connectToFile(config->getString("target"))){ if (connectToFile(config->getString("target"))){
parseData = true; parseData = true;
wantRequest = false; wantRequest = false;
INFO_MSG("Recording %s to %s in FLV format", streamName.c_str(), config->getString("target").c_str()); INFO_MSG("Recording %s to %s in FLV format", streamName.c_str(), config->getString("target").c_str());
}else{ return;
conn.close();
} }
conn.close();
} }
} }