[FFmpeg-cvslog] avformat/flvenc: avoid 24bit timestamp truncation for FLV metadata

asilvestre git at videolan.org
Mon Nov 29 22:37:04 EET 2021


ffmpeg | branch: master | asilvestre <antoni.silvestrepadros at vonage.com> | Fri Nov 26 17:27:18 2021 +0100| [1c2dae153cd6574252fbcf60fb3782440ef43056] | committer: Marton Balint

avformat/flvenc: avoid 24bit timestamp truncation for FLV metadata

FLV AMF tags have a 24bit field for timestamps plus an 8bit for extended
timestamps.

All FLV AMF tags except when we write metadata handle this correctly
using the put_timestamp function.

Until now when writing metadata we were only using the first
24 bits and thus the timestamp value was wraping around 4 hours 40
minutes (16,800,000 ms, max 24 bit value 16,777,216) of playback.

This commit fixes this applying this same function put_timestamp
for the metadata FLV tag.

Signed-off-by: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c2dae153cd6574252fbcf60fb3782440ef43056
---

 libavformat/flvenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index c5926575a1..5130d429ad 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -284,8 +284,8 @@ static void write_metadata(AVFormatContext *s, unsigned int ts)
     avio_w8(pb, FLV_TAG_TYPE_META);            // tag type META
     flv->metadata_size_pos = avio_tell(pb);
     avio_wb24(pb, 0);           // size of data part (sum of all parts below)
-    avio_wb24(pb, ts);          // timestamp
-    avio_wb32(pb, 0);           // reserved
+    put_timestamp(pb, ts);      // timestamp
+    avio_wb24(pb, 0);           // reserved
 
     /* now data of data_size size */
 



More information about the ffmpeg-cvslog mailing list