1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

flvenc: Check whether seeking back to the header succeeded

The FLV muxer tries to update the header in write_trailer, which is
impossible if writing to a pipe or network stream. Don't write header
data if seeking to the header fails.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Björn Axelsson 2012-12-13 14:48:25 +01:00 committed by Martin Storsjö
parent e30e8e311e
commit 1eaff98c83

View File

@ -403,10 +403,14 @@ static int flv_write_trailer(AVFormatContext *s)
file_size = avio_tell(pb);
/* update information */
avio_seek(pb, flv->duration_offset, SEEK_SET);
put_amf_double(pb, flv->duration / (double)1000);
avio_seek(pb, flv->filesize_offset, SEEK_SET);
put_amf_double(pb, file_size);
if (avio_seek(pb, flv->duration_offset, SEEK_SET) < 0)
av_log(s, AV_LOG_WARNING, "Failed to update header with correct duration.\n");
else
put_amf_double(pb, flv->duration / (double)1000);
if (avio_seek(pb, flv->filesize_offset, SEEK_SET) < 0)
av_log(s, AV_LOG_WARNING, "Failed to update header with correct filesize.\n");
else
put_amf_double(pb, file_size);
avio_seek(pb, file_size, SEEK_SET);
return 0;