Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: rcombs <ffmpegagent@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 5/6] lavc/videotoolboxdec: insert emu-prevention bytes for HEVC as well
Date: Mon, 09 May 2022 18:16:23 +0000
Message-ID: <36ea2d6faa1b57b888bf39fc8138130e8e40ef3b.1652120184.git.ffmpegagent@gmail.com> (raw)
In-Reply-To: <pull.23.ffstaging.FFmpeg.1652120184.ffmpegagent@gmail.com>

From: rcombs <rcombs@rcombs.me>

Fixes decoding of files with sync-fooling sequences in their PSs.

Signed-off-by: rcombs <rcombs@rcombs.me>
---
 libavcodec/videotoolbox.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 921fed9619..ce83c2594a 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -246,7 +246,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
     for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
         if (h->ps.t##ps_list[i]) { \
             const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \
-            vt_extradata_size += 2 + lps->data_size; \
+            vt_extradata_size += 2 + escape_ps(NULL, lps->data, lps->data_size); \
             num_##t##ps++; \
         } \
     }
@@ -369,11 +369,11 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
     for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
         if (h->ps.t##ps_list[i]) { \
             const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \
+            int size = escape_ps(p + 2, lps->data, lps->data_size); \
             /* unsigned int(16) nalUnitLength; */ \
-            AV_WB16(p, lps->data_size); \
+            AV_WB16(p, size); \
             /* bit(8*nalUnitLength) nalUnit; */ \
-            memcpy(p + 2, lps->data, lps->data_size); \
-            p += 2 + lps->data_size; \
+            p += 2 + size; \
         } \
     }
 
-- 
ffmpeg-codebot

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

  parent reply	other threads:[~2022-05-09 18:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 18:16 [FFmpeg-devel] [PATCH 0/6] lavc/videotoolboxdec: improve HEVC stream compatibility ffmpegagent
2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 1/6] lavc/videotoolboxdec: warn on nonzero status in the callback rcombs
2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 2/6] lavc/videotoolboxdec: fix escaping sequential zero sequences rcombs
2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 3/6] lavc/videotoolboxdec: fix generating HEVC general_profile_compatibility_flags rcombs
2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 4/6] lavc/videotoolboxdec: fix writing too many 1 bits for the reserved fields rcombs
2022-05-09 18:16 ` rcombs [this message]
2022-05-09 18:16 ` [FFmpeg-devel] [PATCH 6/6] lavc/h264_ps: always include the stop bit in [s|p]ps->data rcombs
2022-05-10  4:26   ` Andreas Rheinhardt
2022-05-24 22:20     ` Ridley Combs

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=36ea2d6faa1b57b888bf39fc8138130e8e40ef3b.1652120184.git.ffmpegagent@gmail.com \
    --to=ffmpegagent@gmail.com \
    --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