@@ -184,7 +184,7 @@ static AVStream *create_stream(AVFormatContext *s, int codec_type)
}
- avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
+ avpriv_set_pts_info(st, 31, 1, 1000); /* 31 bit pts in ms */
flv->last_keyframe_stream_index = s->nb_streams - 1;
add_keyframes_index(s);
return st;
@@ -1033,7 +1033,11 @@ retry:
size = avio_rb24(s->pb);
flv->sum_flv_tag_size += size + 11;
dts = avio_rb24(s->pb);
- dts |= (unsigned)avio_r8(s->pb) << 24;
+ /* FLV timestamps are 32 bits signed, flvenc.c doesn't use the 32 msb, but
+ * other muxer may treat timestamp as uint32_t. We ignore the 32 bit and
+ * handle the wrap by avpriv_set_pts_info().
+ */
+ dts |= ((unsigned)avio_r8(s->pb) & 0x7F) << 24;
av_log(s, AV_LOG_TRACE, "type:%d, size:%d, last:%d, dts:%"PRId64" pos:%"PRId64"\n", type, size, last, dts, avio_tell(s->pb));
if (avio_feof(s->pb))
return AVERROR_EOF;