diff options
author | Björn Axelsson <bjorn.axelsson@intinor.se> | 2012-12-13 17:48:25 +0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-12-20 14:37:42 +0400 |
commit | 1eaff98c8320d9ba48fbaec2a558f31f4104de98 (patch) | |
tree | 7d31782060095c897951eed12edac738671220ef /libavformat/flvenc.c | |
parent | e30e8e311e14236a979ce061538ec8b8bad8655f (diff) |
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>
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r-- | libavformat/flvenc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 8aeea968b4..ff6d14a248 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -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; |