summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2023-07-25 01:41:23 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2023-07-25 13:37:32 +0200
commit6dd5f9509334f53a4217540d430360d49578ecee (patch)
tree9f15f6c6c46bc0dc6994d549888433ac04cb23d2
parentf8035bc4260568f9e37b80c23a43f676d7da39c2 (diff)
avformat/flvdec: fix size desync when reading timestamp offsets
The size offset was previously being accounted for in flv_set_video_codec for h264 and mpeg4, instead of being directly accounted for in the spot where its read, which desynced on HEVC streams. For clarity, move the size offset directly to the parsing, similar to how its done for all other header fields.
-rw-r--r--libavformat/flvdec.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index a6a94a4021..3fe21622f7 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -407,11 +407,9 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream,
case FLV_CODECID_H264:
par->codec_id = AV_CODEC_ID_H264;
vstreami->need_parsing = AVSTREAM_PARSE_HEADERS;
- ret = 3; // not 4, reading packet type will consume one byte
break;
case FLV_CODECID_MPEG4:
par->codec_id = AV_CODEC_ID_MPEG4;
- ret = 3;
break;
default:
avpriv_request_sample(s, "Video codec (%x)", flv_codecid);
@@ -1321,6 +1319,7 @@ retry_duration:
"invalid timestamps %"PRId64" %"PRId64"\n", dts, pts);
dts = pts = AV_NOPTS_VALUE;
}
+ size -= 3;
}
if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC ||
st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC ||