* [FFmpeg-devel] [PATCH] flvdec: fix size desync when reading timestamp offsets
@ 2023-07-24 23:41 Hendrik Leppkes
2023-07-25 0:10 ` Timo Rothenpieler
0 siblings, 1 reply; 2+ messages in thread
From: Hendrik Leppkes @ 2023-07-24 23:41 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Hendrik Leppkes
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.
---
libavformat/flvdec.c | 3 +--
1 file changed, 1 insertion(+), 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 ||
--
2.40.1.windows.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] flvdec: fix size desync when reading timestamp offsets
2023-07-24 23:41 [FFmpeg-devel] [PATCH] flvdec: fix size desync when reading timestamp offsets Hendrik Leppkes
@ 2023-07-25 0:10 ` Timo Rothenpieler
0 siblings, 0 replies; 2+ messages in thread
From: Timo Rothenpieler @ 2023-07-25 0:10 UTC (permalink / raw)
To: ffmpeg-devel
On 25.07.2023 01:41, Hendrik Leppkes wrote:
> 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.
> ---
> libavformat/flvdec.c | 3 +--
> 1 file changed, 1 insertion(+), 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 ||
tested with both h264 and hevc input, works fine
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-25 0:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 23:41 [FFmpeg-devel] [PATCH] flvdec: fix size desync when reading timestamp offsets Hendrik Leppkes
2023-07-25 0:10 ` Timo Rothenpieler
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git