Skip to content

Commit 189810a

Browse files
authored
Merge pull request #13 from media-kit/fix/vp9-hwaccel
fix: VP9 HWAccel
2 parents 850ed6a + e52d7f2 commit 189810a

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

patches/ffmpeg-fix-vp9-hwaccel.patch

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
2+
index e593ad1..f074ac8 100644
3+
--- a/libavcodec/allcodecs.c
4+
+++ b/libavcodec/allcodecs.c
5+
@@ -884,6 +884,7 @@ extern const FFCodec ff_vp9_cuvid_decoder;
6+
extern const FFCodec ff_vp9_mediacodec_decoder;
7+
extern const FFCodec ff_vp9_qsv_decoder;
8+
extern const FFCodec ff_vp9_vaapi_encoder;
9+
+extern const FFCodec ff_vp9_videotoolbox_decoder;
10+
extern const FFCodec ff_vp9_qsv_encoder;
11+
12+
// null codecs
13+
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
14+
index 7c0a246..2abd3d3 100644
15+
--- a/libavcodec/vp9.c
16+
+++ b/libavcodec/vp9.c
17+
@@ -1906,6 +1906,35 @@ const FFCodec ff_vp9_decoder = {
18+
#if CONFIG_VP9_VDPAU_HWACCEL
19+
HWACCEL_VDPAU(vp9),
20+
#endif
21+
+ NULL
22+
+ },
23+
+};
24+
+
25+
+const FFCodec ff_vp9_videotoolbox_decoder = {
26+
+ .p.name = "vp9_videotoolbox",
27+
+ CODEC_LONG_NAME("VideoToolbox Google VP9"),
28+
+ .p.type = AVMEDIA_TYPE_VIDEO,
29+
+ .p.id = AV_CODEC_ID_VP9,
30+
+ .priv_data_size = sizeof(VP9Context),
31+
+ .init = vp9_decode_init,
32+
+ .close = vp9_decode_free,
33+
+ FF_CODEC_DECODE_CB(vp9_decode_frame),
34+
+ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS,
35+
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP |
36+
+ FF_CODEC_CAP_SLICE_THREAD_HAS_MF |
37+
+ FF_CODEC_CAP_ALLOCATE_PROGRESS,
38+
+ .flush = vp9_decode_flush,
39+
+ UPDATE_THREAD_CONTEXT(vp9_decode_update_thread_context),
40+
+ .p.profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
41+
+#if ARCH_X86_64
42+
+ /* @low-batt: Video Toolbox requires VP9 invisible (alt-ref) frames be merged into VP9 superframes when running on Intel
43+
+ * based Macs. Violation of this requirement will cause Video Toolbox to hang due to defective error handing
44+
+ * in VTDecompressionSessionDecodeFrame. See FFmpeg ticket #9599. */
45+
+ .bsfs = "vp9_superframe",
46+
+#else
47+
+ .bsfs = "vp9_superframe_split",
48+
+#endif
49+
+ .hw_configs = (const AVCodecHWConfigInternal *const []) {
50+
#if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL
51+
HWACCEL_VIDEOTOOLBOX(vp9),
52+
#endif

scripts/ffmpeg/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -u # treat unset variables as an error
55

66
cd ${SRC_DIR}
77

8+
patch -p1 <${PROJECT_DIR}/patches/ffmpeg-fix-vp9-hwaccel.patch
89
patch -p1 <${PROJECT_DIR}/patches/ffmpeg-fix-hls-mp4-seek.patch
910
patch -p1 <${PROJECT_DIR}/patches/ffmpeg-fix-ios-hdr-texture.patch
1011
patch -p1 <${PROJECT_DIR}/patches/ffmpeg-fix-dash-base-url-escape.patch

0 commit comments

Comments
 (0)