Backport fixes by comparing n8.1.1 and release/8.1

Signed-off-by: nyanmisaka <nst799610810@gmail.com>
This commit is contained in:
nyanmisaka
2026-06-12 23:00:37 +08:00
parent 899cce622b
commit a56c1efedf
3 changed files with 765 additions and 34 deletions
@@ -1,37 +1,3 @@
Index: FFmpeg/libavcodec/vulkan_encode.c
===================================================================
--- FFmpeg.orig/libavcodec/vulkan_encode.c
+++ FFmpeg/libavcodec/vulkan_encode.c
@@ -772,14 +772,6 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR(EINVAL);
}
- if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
- feedback_flags) {
- av_log (avctx, AV_LOG_ERROR,
- "Driver does not support required encode feedback flags "
- "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
- return AVERROR(ENOTSUP);
- }
-
ctx->base.op = &vulkan_base_encode_ops;
ctx->codec = codec;
@@ -881,6 +873,14 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR_EXTERNAL;
}
+ if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
+ feedback_flags) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Driver does not support required encode feedback flags "
+ "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
+ return AVERROR(ENOTSUP);
+ }
+
err = init_rc(avctx, ctx);
if (err < 0)
return err;
Index: FFmpeg/libavcodec/vulkan_encode.h
===================================================================
--- FFmpeg.orig/libavcodec/vulkan_encode.h
@@ -0,0 +1,764 @@
Index: FFmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S
===================================================================
--- FFmpeg.orig/libavcodec/aarch64/vp9lpf_16bpp_neon.S
+++ FFmpeg/libavcodec/aarch64/vp9lpf_16bpp_neon.S
@@ -56,9 +56,7 @@
mov x11, v4.d[0]
mov x12, v4.d[1]
adds x11, x11, x12
- b.ne 1f
- ret x10
-1:
+ b.eq 9f
.if \wd >= 8
dup v0.8h, w5
@@ -189,13 +187,7 @@
// If no pixels need flat8in, jump to flat8out
// (or to a writeout of the inner 4 pixels, for wd=8)
.if \wd >= 8
-.if \wd == 16
b.eq 6f
-.else
- b.ne 1f
- ret x13
-1:
-.endif
// flat8in
add \tmp1\().8h, v20.8h, v21.8h
@@ -249,20 +241,16 @@
mov x11, v2.d[0]
mov x12, v2.d[1]
adds x11, x11, x12
- b.ne 1f
// If no pixels needed flat8in nor flat8out, jump to a
// writeout of the inner 4 pixels
- ret x14
-1:
+ b.eq 7f
mov x11, v7.d[0]
mov x12, v7.d[1]
adds x11, x11, x12
- b.ne 1f
// If no pixels need flat8out, jump to a writeout of the inner 6 pixels
- ret x15
+ b.eq 8f
-1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -378,35 +366,57 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
+ mov x13, #0
loop_filter 4, v16, v17, v18, v19, v28, v29, v30, v31
ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8
+ mov x13, #0
loop_filter 8, v16, v17, v18, v19, v28, v29, v30, v31
ret
+6:
+ mov x13, #(1<<6)
+ ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16
+ mov x13, #0
loop_filter 16, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
+9:
+ mov x13, #(1<<9)
+ ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8
- // calculate alternative 'return' targets
- adr x13, 6f
bl vp9_loop_filter_8
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
@@ -540,7 +550,7 @@ function vp9_loop_filter_v_4_8_16_neon
st1 {v23.8h}, [x9], x1
st1 {v25.8h}, [x0], x1
sub x0, x0, x1, lsl #1
-
+9:
ret x10
endfunc
@@ -588,7 +598,7 @@ function vp9_loop_filter_h_4_8_16_neon
st1 {v25.d}[1], [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #4
-
+9:
ret x10
endfunc
@@ -619,7 +629,7 @@ function vp9_loop_filter_v_8_8_16_neon
st1 {v26.8h}, [x0], x1
sub x0, x0, x1, lsl #1
sub x0, x0, x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -670,7 +680,7 @@ function vp9_loop_filter_h_8_8_16_neon
st1 {v27.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, #8
-
+9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -742,7 +752,7 @@ function vp9_loop_filter_v_16_8_16_neon
st1 {v17.8h}, [x0], x1
sub x0, x0, x1, lsl #3
add x0, x0, x1
-
+9:
ret x10
8:
add x9, x9, x1, lsl #2
@@ -820,7 +830,7 @@ function vp9_loop_filter_h_16_8_16_neon
st1 {v9.8h}, [x9], x1
st1 {v31.8h}, [x0], x1
sub x0, x0, x1, lsl #3
-
+9:
ret x10
8:
// The same writeback as in loop_filter_h_8_8
Index: FFmpeg/libavcodec/aarch64/vp9lpf_neon.S
===================================================================
--- FFmpeg.orig/libavcodec/aarch64/vp9lpf_neon.S
+++ FFmpeg/libavcodec/aarch64/vp9lpf_neon.S
@@ -388,32 +388,28 @@
.endif
.if \wd == 16
6:
+ // If no pixels needed flat8in nor flat8out, jump to a
+ // writeout of the inner 4 pixels
orr v2\sz, v6\sz, v7\sz
mov x5, v2.d[0]
.ifc \sz, .16b
mov x6, v2.d[1]
adds x5, x5, x6
- b.ne 1f
+ b.eq 7f
.else
- cbnz x5, 1f
+ cbz x5, 7f
.endif
- // If no pixels needed flat8in nor flat8out, jump to a
- // writeout of the inner 4 pixels
- ret x14
-1:
+ // If no pixels need flat8out, jump to a writeout of the inner 6 pixels
mov x5, v7.d[0]
.ifc \sz, .16b
mov x6, v7.d[1]
adds x5, x5, x6
- b.ne 1f
+ b.eq 8f
.else
- cbnz x5, 1f
+ cbz x5, 8f
.endif
- // If no pixels need flat8out, jump to a writeout of the inner 6 pixels
- ret x15
-1:
// flat8out
// This writes all outputs into v2-v17 (skipping v6 and v16).
// If this part is skipped, the output is read from v21-v26 (which is the input
@@ -529,76 +525,94 @@
// while we need those for inputs/outputs in wd=16 and use v8-v15
// for temp registers there instead.
function vp9_loop_filter_4
+ mov x13, #0
loop_filter 4, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_4_16b_mix_44
+ mov x13, #0
loop_filter 4, .16b, 44, v16, v17, v18, v19, v28, v29, v30, v31
ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8
+ mov x13, #0
loop_filter 8, .8b, 0, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
- ret x13
+ mov x13, #(1<<6)
+ ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_8_16b_mix
+ mov x13, #0
loop_filter 8, .16b, 88, v16, v17, v18, v19, v28, v29, v30, v31
ret
6:
- ret x13
+ mov x13, #(1<<6)
+ ret
9:
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16
+ mov x13, #0
loop_filter 16, .8b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
9:
- ldp d10, d11, [sp, #0x10]
- ldp d12, d13, [sp, #0x20]
- ldp d14, d15, [sp, #0x30]
- ldp d8, d9, [sp], #0x40
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
function vp9_loop_filter_16_16b
+ mov x13, #0
loop_filter 16, .16b, 0, v8, v9, v10, v11, v12, v13, v14, v15
ret
+7:
+ mov x13, #(1<<7)
+ ret
+8:
+ mov x13, #(1<<8)
+ ret
9:
- ldp d10, d11, [sp, #0x10]
- ldp d12, d13, [sp, #0x20]
- ldp d14, d15, [sp, #0x30]
- ldp d8, d9, [sp], #0x40
- ret x10
+ mov x13, #(1<<9)
+ ret
endfunc
.macro loop_filter_4
bl vp9_loop_filter_4
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_4_16b_mix mix
bl vp9_loop_filter_4_16b_mix_\mix
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8
- // calculate alternative 'return' targets
- adr x13, 6f
bl vp9_loop_filter_8
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_8_16b_mix mix
- // calculate alternative 'return' targets
- adr x13, 6f
.if \mix == 48
mov x11, #0xffffffff00000000
.elseif \mix == 84
@@ -607,20 +621,22 @@ endfunc
mov x11, #0xffffffffffffffff
.endif
bl vp9_loop_filter_8_16b_mix
+ tbnz x13, #6, 6f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
.macro loop_filter_16_16b
- // calculate alternative 'return' targets
- adr x14, 7f
- adr x15, 8f
bl vp9_loop_filter_16_16b
+ tbnz x13, #7, 7f
+ tbnz x13, #8, 8f
+ tbnz x13, #9, 9f
.endm
@@ -647,7 +663,7 @@ function ff_vp9_loop_filter_v_4_8_neon,
st1 {v24.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v25.8b}, [x0], x1
-
+9:
ret x10
endfunc
@@ -671,7 +687,7 @@ function ff_vp9_loop_filter_v_44_16_neon
st1 {v24.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v25.16b}, [x0], x1
-
+9:
ret x10
endfunc
@@ -713,7 +729,7 @@ function ff_vp9_loop_filter_h_4_8_neon,
st1 {v24.s}[1], [x0], x1
st1 {v25.s}[0], [x9], x1
st1 {v25.s}[1], [x0], x1
-
+9:
ret x10
endfunc
@@ -765,7 +781,7 @@ function ff_vp9_loop_filter_h_44_16_neon
st1 {v24.s}[3], [x0], x1
st1 {v25.s}[1], [x9], x1
st1 {v25.s}[3], [x0], x1
-
+9:
ret x10
endfunc
@@ -792,7 +808,7 @@ function ff_vp9_loop_filter_v_8_8_neon,
st1 {v25.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v26.8b}, [x0], x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -827,7 +843,7 @@ function ff_vp9_loop_filter_v_\mix\()_16
st1 {v25.16b}, [x0], x1
st1 {v23.16b}, [x9], x1
st1 {v26.16b}, [x0], x1
-
+9:
ret x10
6:
sub x9, x0, x1, lsl #1
@@ -875,7 +891,7 @@ function ff_vp9_loop_filter_h_8_8_neon,
st1 {v26.8b}, [x0], x1
st1 {v23.8b}, [x9], x1
st1 {v27.8b}, [x0], x1
-
+9:
ret x10
6:
// If we didn't need to do the flat8in part, we use the same writeback
@@ -941,7 +957,7 @@ function ff_vp9_loop_filter_h_\mix\()_16
st1 {v26.d}[1], [x0], x1
st1 {v27.8b}, [x9], x1
st1 {v27.d}[1], [x0], x1
-
+9:
ret x10
6:
add x9, x9, #2
Index: FFmpeg/libavcodec/vulkan_encode.c
===================================================================
--- FFmpeg.orig/libavcodec/vulkan_encode.c
+++ FFmpeg/libavcodec/vulkan_encode.c
@@ -772,14 +772,6 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR(EINVAL);
}
- if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
- feedback_flags) {
- av_log (avctx, AV_LOG_ERROR,
- "Driver does not support required encode feedback flags "
- "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
- return AVERROR(ENOTSUP);
- }
-
ctx->base.op = &vulkan_base_encode_ops;
ctx->codec = codec;
@@ -881,6 +873,14 @@ av_cold int ff_vulkan_encode_init(AVCode
return AVERROR_EXTERNAL;
}
+ if ((ctx->enc_caps.supportedEncodeFeedbackFlags & feedback_flags) !=
+ feedback_flags) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Driver does not support required encode feedback flags "
+ "(BUFFER_OFFSET and BYTES_WRITTEN).\n");
+ return AVERROR(ENOTSUP);
+ }
+
err = init_rc(avctx, ctx);
if (err < 0)
return err;
Index: FFmpeg/libavformat/dashdec.c
===================================================================
--- FFmpeg.orig/libavformat/dashdec.c
+++ FFmpeg/libavformat/dashdec.c
@@ -447,7 +447,7 @@ static int open_url(AVFormatContext *s,
av_freep(pb);
av_dict_copy(&tmp, *opts, 0);
av_dict_copy(&tmp, opts2, 0);
- ret = ffio_open_whitelist(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp, s->protocol_whitelist, s->protocol_blacklist);
+ ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp);
if (ret >= 0) {
// update cookies on http response with setcookies.
char *new_cookies = NULL;
@@ -1255,7 +1255,7 @@ static int parse_manifest(AVFormatContex
close_in = 1;
av_dict_copy(&opts, c->avio_opts, 0);
- ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ, c->interrupt_callback, &opts, s->protocol_whitelist, s->protocol_blacklist);
+ ret = s->io_open(s, &in, url, AVIO_FLAG_READ, &opts);
av_dict_free(&opts);
if (ret < 0)
return ret;
@@ -1398,7 +1398,7 @@ cleanup:
av_bprint_finalize(&buf, NULL);
if (close_in) {
- avio_close(in);
+ ff_format_io_close(s, &in);
}
return ret;
}
Index: FFmpeg/libavformat/dashenc.c
===================================================================
--- FFmpeg.orig/libavformat/dashenc.c
+++ FFmpeg/libavformat/dashenc.c
@@ -490,7 +490,7 @@ static void dash_free(AVFormatContext *s
if (!c->single_file)
ffio_free_dyn_buf(&os->ctx->pb);
else
- avio_close(os->ctx->pb);
+ ff_format_io_close(s, &os->ctx->pb);
}
ff_format_io_close(s, &os->out);
avformat_free_context(os->ctx);
@@ -1458,7 +1458,7 @@ static int dash_init(AVFormatContext *s)
ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, &opts);
} else {
ctx->url = av_strdup(filename);
- ret = avio_open2(&ctx->pb, filename, AVIO_FLAG_WRITE, NULL, &opts);
+ ret = s->io_open(s, &ctx->pb, filename, AVIO_FLAG_WRITE, &opts);
}
av_dict_free(&opts);
if (ret < 0)
Index: FFmpeg/libavformat/demux.c
===================================================================
--- FFmpeg.orig/libavformat/demux.c
+++ FFmpeg/libavformat/demux.c
@@ -368,7 +368,7 @@ fail:
ff_id3v2_free_extra_meta(&id3v2_extra_meta);
av_dict_free(&tmp);
if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))
- avio_closep(&s->pb);
+ ff_format_io_close(s, &s->pb);
avformat_free_context(s);
*ps = NULL;
return ret;
Index: FFmpeg/libavformat/hlsenc.c
===================================================================
--- FFmpeg.orig/libavformat/hlsenc.c
+++ FFmpeg/libavformat/hlsenc.c
@@ -703,7 +703,7 @@ static int do_encrypt(AVFormatContext *s
return ret;
avio_seek(pb, 0, SEEK_CUR);
avio_write(pb, key, KEYSIZE);
- avio_close(pb);
+ ff_format_io_close(s, &pb);
}
return 0;
}
@@ -1171,9 +1171,7 @@ static int parse_playlist(AVFormatContex
const char *end;
double discont_program_date_time = 0;
- if ((ret = ffio_open_whitelist(&in, url, AVIO_FLAG_READ,
- &s->interrupt_callback, NULL,
- s->protocol_whitelist, s->protocol_blacklist)) < 0)
+ if ((ret = s->io_open(s, &in, url, AVIO_FLAG_READ, NULL)) < 0)
return ret;
ff_get_chomp_line(in, line, sizeof(line));
@@ -1283,7 +1281,7 @@ static int parse_playlist(AVFormatContex
}
fail:
- avio_close(in);
+ ff_format_io_close(s, &in);
return ret;
}
Index: FFmpeg/libavformat/mov.c
===================================================================
--- FFmpeg.orig/libavformat/mov.c
+++ FFmpeg/libavformat/mov.c
@@ -1237,15 +1237,13 @@ static int mov_read_chnl(MOVContext *c,
version = avio_r8(pb);
flags = avio_rb24(pb);
if (version != 0 || flags != 0) {
- av_log(c->fc, AV_LOG_ERROR,
- "Unsupported 'chnl' box with version %d, flags: %#x",
+ av_log(c->fc, AV_LOG_WARNING,
+ "Unsupported 'chnl' box with version %d, flags: %#x\n",
version, flags);
- return AVERROR_INVALIDDATA;
+ return 0;
}
- ret = ff_mov_read_chnl(c->fc, pb, st);
- if (ret < 0)
- return ret;
+ ff_mov_read_chnl(c->fc, pb, st);
if (avio_tell(pb) != end) {
av_log(c->fc, AV_LOG_WARNING, "skip %" PRId64 " bytes of unknown data inside chnl\n",
Index: FFmpeg/libavformat/mov_chan.c
===================================================================
--- FFmpeg.orig/libavformat/mov_chan.c
+++ FFmpeg/libavformat/mov_chan.c
@@ -375,6 +375,7 @@ static int mov_get_channel_layout(AVChan
/* find the channel layout for the specified layout tag */
layout_map = find_layout_map(tag, map);
if (layout_map) {
+ AVChannelLayout tmp = { 0 };
int ret;
int map_layout_nb_channels = tag & 0xFFFF;
int nb_channels = ch_layout->nb_channels;
@@ -383,19 +384,23 @@ static int mov_get_channel_layout(AVChan
if (omitted_channel_map >> map_layout_nb_channels)
return AVERROR_INVALIDDATA;
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
return ret;
for (int i = 0, idx = 0; i < map_layout_nb_channels && idx < nb_channels; i++, omitted_channel_map >>= 1) {
if (!(omitted_channel_map & 1)) {
enum AVChannel id = layout_map[i].id;
- ch_layout->u.map[idx++].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN);
+ tmp.u.map[idx++].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN);
}
}
- return av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ if (ret < 0)
+ return ret;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
}
return 0;
}
@@ -543,6 +548,7 @@ int ff_mov_read_chan(AVFormatContext *s,
return 0;
if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) {
+ AVChannelLayout tmp = { 0 };
int nb_channels = ch_layout->nb_channels;
if (!num_descr || num_descr < nb_channels) {
@@ -562,8 +568,7 @@ int ff_mov_read_chan(AVFormatContext *s,
num_descr = nb_channels;
}
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
goto out;
@@ -580,12 +585,15 @@ int ff_mov_read_chan(AVFormatContext *s,
avio_rl32(pb); // mCoordinates[1]
avio_rl32(pb); // mCoordinates[2]
size -= 20;
- ch_layout->u.map[i].id = mov_get_channel_id(label);
+ tmp.u.map[i].id = mov_get_channel_id(label);
}
- ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
if (ret < 0)
goto out;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
} else if (layout_tag == MOV_CH_LAYOUT_USE_BITMAP) {
if (!ch_layout->nb_channels || av_popcount(bitmap) == ch_layout->nb_channels) {
if (bitmap < 0x40000) {
@@ -737,11 +745,10 @@ int ff_mov_read_chnl(AVFormatContext *s,
av_log(s, AV_LOG_TRACE, "'chnl' layout %d\n", layout);
if (!layout) {
- AVChannelLayout *ch_layout = &st->codecpar->ch_layout;
+ AVChannelLayout tmp = { 0 }, *ch_layout = &st->codecpar->ch_layout;
int nb_channels = ch_layout->nb_channels;
- av_channel_layout_uninit(ch_layout);
- ret = av_channel_layout_custom_init(ch_layout, nb_channels);
+ ret = av_channel_layout_custom_init(&tmp, nb_channels);
if (ret < 0)
return ret;
@@ -762,12 +769,15 @@ int ff_mov_read_chnl(AVFormatContext *s,
channel = AV_CHAN_UNKNOWN;
}
- ch_layout->u.map[i].id = channel;
+ tmp.u.map[i].id = channel;
}
- ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
+ ret = av_channel_layout_retype(&tmp, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL);
if (ret < 0)
return ret;
+
+ av_channel_layout_uninit(ch_layout);
+ *ch_layout = tmp;
} else {
uint64_t omitted_channel_map = avio_rb64(pb);
ret = ff_mov_get_channel_layout_from_config(layout, &st->codecpar->ch_layout, omitted_channel_map);
Index: FFmpeg/libavformat/oggparsecelt.c
===================================================================
--- FFmpeg.orig/libavformat/oggparsecelt.c
+++ FFmpeg/libavformat/oggparsecelt.c
@@ -27,6 +27,9 @@
#include "internal.h"
#include "oggdec.h"
+/* CELT-over-Ogg streams use at most a couple of vorbiscomment "extra" headers. */
+#define CELT_MAX_EXTRA_HEADERS 16
+
struct oggcelt_private {
int extra_headers_left;
};
@@ -62,6 +65,12 @@ static int celt_header(AVFormatContext *
overlap = AV_RL32(p + 48);
/* unused bytes per packet field skipped */
extra_headers = AV_RL32(p + 56);
+ if (extra_headers > CELT_MAX_EXTRA_HEADERS) {
+ av_log(s, AV_LOG_ERROR,
+ "Too many CELT extra headers (%u)\n", extra_headers);
+ av_free(priv);
+ return AVERROR_INVALIDDATA;
+ }
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = AV_CODEC_ID_CELT;
st->codecpar->sample_rate = sample_rate;
Index: FFmpeg/libavformat/oggparsevorbis.c
===================================================================
--- FFmpeg.orig/libavformat/oggparsevorbis.c
+++ FFmpeg/libavformat/oggparsevorbis.c
@@ -230,8 +230,11 @@ static int fixup_vorbis_headers(AVFormat
int i, offset, len, err;
int buf_len;
unsigned char *ptr;
+ uint64_t total_len = (uint64_t)priv->len[0] + priv->len[1] + priv->len[2];
+ if (total_len + total_len / 255 + 64 > INT_MAX)
+ return AVERROR_INVALIDDATA;
- len = priv->len[0] + priv->len[1] + priv->len[2];
+ len = total_len;
buf_len = len + len / 255 + 64;
if (*buf)
Index: FFmpeg/libavformat/rtpdec_av1.c
===================================================================
--- FFmpeg.orig/libavformat/rtpdec_av1.c
+++ FFmpeg/libavformat/rtpdec_av1.c
@@ -249,7 +249,7 @@ static int av1_handle_packet(AVFormatCon
// ignore and remove OBUs according to spec
if ((obu_type == AV1_OBU_TEMPORAL_DELIMITER) ||
(obu_type == AV1_OBU_TILE_LIST)) {
- pktpos += obu_size;
+ buf_ptr += obu_size;
rem_pkt_size -= obu_size;
// TODO: This probably breaks if the OBU_TILE_LIST is fragmented
// into the next RTP packet, so at least check and fail here
Index: FFmpeg/libavformat/version.h
===================================================================
--- FFmpeg.orig/libavformat/version.h
+++ FFmpeg/libavformat/version.h
@@ -32,7 +32,7 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 12
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
+1
View File
@@ -89,3 +89,4 @@
0089-add-webp-to-matroskadec-image-mime-types.patch
0090-relax-to-allow-safe-filenames-in-mkv-attachments.patch
0091-backport-a-fix-to-use-sw-pix-fmt-in-codec-par-if-set.patch
0092-backport-fixes-by-comparing-n8-1-1-and-release-8-1.patch