Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Timo Rothenpieler <timo@rothenpieler.org>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] flvdec: fix size desync when reading timestamp offsets
Date: Tue, 25 Jul 2023 02:10:01 +0200
Message-ID: <f959b280-abf1-442c-dc92-d4ccb290fe25@rothenpieler.org> (raw)
In-Reply-To: <20230724234123.1054-1-h.leppkes@gmail.com>

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".

      reply	other threads:[~2023-07-25  0:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24 23:41 Hendrik Leppkes
2023-07-25  0:10 ` Timo Rothenpieler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f959b280-abf1-442c-dc92-d4ccb290fe25@rothenpieler.org \
    --to=timo@rothenpieler.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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