Commit 44cb8a1e authored by Stefan Westerfeld's avatar Stefan Westerfeld

HLS: handle fopen() errors in TSWriter::process()

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 0078623f
......@@ -471,7 +471,13 @@ hls_prepare (const string& in_dir, const string& out_dir, const string& filename
writer.append_data ("full.flac", full_flac_mem);
writer.append_vars ("vars", segment.vars);
writer.process (in_dir + "/" + segment.name, out_dir + "/" + segment.name);
err = writer.process (in_dir + "/" + segment.name, out_dir + "/" + segment.name);
if (err)
{
error ("audiowmark: processing hls segment %s failed: %s\n", segment.name.c_str(), err.message());
return 1;
}
/* start position for the next segment */
start_pos += segment.size;
......
......@@ -199,6 +199,18 @@ TSWriter::process (const string& inname, const string& outname)
ScopedFile infile_s (infile);
ScopedFile outfile_s (outfile);
if (!infile)
{
error ("audiowmark: unable to open %s for reading\n", inname.c_str());
return Error (strerror (errno));
}
if (!outfile)
{
error ("audiowmark: unable to open %s for writing\n", outname.c_str());
return Error (strerror (errno));
}
while (!feof (infile))
{
TSPacket p;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment