From: Hayden Myers via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: haydenm315@gmail.com, ffmpeg-devel@ffmpeg.org
Cc: Hayden Myers <haydenm315@gmail.com>
Subject: [FFmpeg-devel] [PATCH V2] libavformat/rtpdec_jpeg.c: Allow sender to include the qtable in fragment offset calculation
Date: Wed, 10 Dec 2025 12:55:27 -0500
Message-ID: <20251210175527.358347-1-haydenm315@gmail.com> (raw)
Signed-off-by: Hayden Myers <haydenm315@gmail.com>
---
libavformat/rtpdec_jpeg.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/libavformat/rtpdec_jpeg.c b/libavformat/rtpdec_jpeg.c
index 4d9ee0d754..be2316da9b 100644
--- a/libavformat/rtpdec_jpeg.c
+++ b/libavformat/rtpdec_jpeg.c
@@ -353,9 +353,25 @@ static int jpeg_parse_packet(AVFormatContext *ctx, PayloadContext *jpeg,
}
if (off != avio_tell(jpeg->frame) - jpeg->hdr_size) {
- av_log(ctx, AV_LOG_ERROR,
- "Missing packets; dropping frame.\n");
- return AVERROR(EAGAIN);
+ /* The fragment offset may include the quant table data. Allow the
+ * offset to differ by the size of the quant header and table.
+ */
+
+ // Default to 2 * 64 byte tables for 8 bit precision.
+ int qtable_len = 128;
+
+ // Use the q table len value stored in the ctx
+ if (q > 127 && q < 255)
+ qtable_len = jpeg->qtables_len[q-128];
+
+ // account for MBZ, Precision, and Length bytes.
+ qtable_len += 4;
+
+ if (off != (avio_tell(jpeg->frame) - (jpeg->hdr_size - qtable_len))) {
+ av_log(ctx, AV_LOG_ERROR,
+ "Missing packets; dropping frame.\n");
+ return AVERROR(EAGAIN);
+ }
}
/* Copy data to frame buffer. */
--
2.43.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-12-10 17:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251210175527.358347-1-haydenm315@gmail.com \
--to=ffmpeg-devel@ffmpeg.org \
--cc=haydenm315@gmail.com \
/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