[FFmpeg-cvslog] dxva2_hevc: don't use frames as reference if they are not marked as such

2022-03-27 Thread Steve Lhomme
ffmpeg | branch: master | Steve Lhomme  | Wed Mar 23 14:54:26 
2022 +0100| [723065a3466c7a05ef9c7cecda501115e789d261] | committer: Hendrik 
Leppkes

dxva2_hevc: don't use frames as reference if they are not marked as such

Similar to how a frame is considered for referencing for the RefPicList array.
This will do the same for RefPicSetStCurrBefore, RefPicSetStCurrAfter and
RefPicSetLtCurr.

Fixes playback of http://www.gbbsoft.pl/!download/!/Film1.mp4
Ref. VLC issue https://code.videolan.org/videolan/vlc/-/issues/26738

Signed-off-by: Steve Lhomme 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=723065a3466c7a05ef9c7cecda501115e789d261
---

 libavcodec/dxva2_hevc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/dxva2_hevc.c b/libavcodec/dxva2_hevc.c
index c91bcf3eeb..6b239d9917 100644
--- a/libavcodec/dxva2_hevc.c
+++ b/libavcodec/dxva2_hevc.c
@@ -184,7 +184,7 @@ static void fill_picture_parameters(const AVCodecContext 
*avctx, AVDXVAContext *
 const HEVCFrame *frame = NULL; \
 while (!frame && j < rpl->nb_refs) \
 frame = rpl->ref[j++]; \
-if (frame) \
+if (frame && frame->flags & (HEVC_FRAME_FLAG_LONG_REF | 
HEVC_FRAME_FLAG_SHORT_REF)) \
 pp->ref_list[i] = get_refpic_index(pp, 
ff_dxva2_get_surface_index(avctx, ctx, frame->frame)); \
 else \
 pp->ref_list[i] = 0xff; \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat: Do not search through the AVOption table for a option not in it repeatedly on each packet

2022-03-27 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri 
Mar 25 23:51:29 2022 +0100| [6265f0b4e1978485b8147ce7dbd5bc7533e7a298] | 
committer: Michael Niedermayer

avformat: Do not search through the AVOption table for a option not in it 
repeatedly on each packet

This search takes alot of time especially when compared with small packets

46631 decicycles -> 15719 decicycles in read_frame_internal() for amr-nb in 3gp

Reviewed-by: Paul B Mahol 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6265f0b4e1978485b8147ce7dbd5bc7533e7a298
---

 libavformat/demux.c| 15 +--
 libavformat/internal.h |  5 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libavformat/demux.c b/libavformat/demux.c
index ac1f16edcd..ef189d9d8e 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1407,12 +1407,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 }
 
-av_opt_get_dict_val(s, "metadata", AV_OPT_SEARCH_CHILDREN, &metadata);
-if (metadata) {
-s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
-av_dict_copy(&s->metadata, metadata, 0);
-av_dict_free(&metadata);
-av_opt_set_dict_val(s, "metadata", NULL, AV_OPT_SEARCH_CHILDREN);
+if (!si->metafree) {
+int metaret = av_opt_get_dict_val(s, "metadata", 
AV_OPT_SEARCH_CHILDREN, &metadata);
+if (metadata) {
+s->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
+av_dict_copy(&s->metadata, metadata, 0);
+av_dict_free(&metadata);
+av_opt_set_dict_val(s, "metadata", NULL, AV_OPT_SEARCH_CHILDREN);
+}
+si->metafree = metaret == AVERROR_OPTION_NOT_FOUND;
 }
 
 if (s->debug & FF_FDEBUG_TS)
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 342e6f7327..3ad76d992c 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -183,6 +183,11 @@ typedef struct FFFormatContext {
  * Set if chapter ids are strictly monotonic.
  */
 int chapter_ids_monotonic;
+
+/**
+ * Contexts and child contexts do not contain a metadata option
+ */
+int metafree;
 } FFFormatContext;
 
 static av_always_inline FFFormatContext *ffformatcontext(AVFormatContext *s)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/cafdec: Do not store empty keys in read_info_chunk()

2022-03-27 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Mar 19 23:36:22 2022 +0100| [7ec28e1d4cef723485f50f7a08859752b79b570c] | 
committer: Michael Niedermayer

avformat/cafdec: Do not store empty keys in read_info_chunk()

Fixes: Timeout
Fixes: 
45543/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-5684953164152832

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ec28e1d4cef723485f50f7a08859752b79b570c
---

 libavformat/cafdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index f0c2c50c59..f6c84e0dae 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -241,6 +241,8 @@ static void read_info_chunk(AVFormatContext *s, int64_t 
size)
 char value[1024];
 avio_get_str(pb, INT_MAX, key, sizeof(key));
 avio_get_str(pb, INT_MAX, value, sizeof(value));
+if (!*key)
+continue;
 av_dict_set(&s->metadata, key, value, 0);
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/alp: Check num_channels

2022-03-27 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat 
Mar 19 23:28:53 2022 +0100| [2e069f6b69475683207ea05deb269f9c532633bb] | 
committer: Michael Niedermayer

avformat/alp: Check num_channels

Fixes: division by 0
Fixes: 
45615/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-582660348405350
Fixes: 
45625/clusterfuzz-testcase-minimized-ffmpeg_dem_ALP_fuzzer-4821437943250944
Fixes: 
45839/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5857286998851584.fuzz
Fixes: 
45844/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6552705772945408

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e069f6b69475683207ea05deb269f9c532633bb
---

 libavformat/alp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/alp.c b/libavformat/alp.c
index f2428a9e3b..40e4890a38 100644
--- a/libavformat/alp.c
+++ b/libavformat/alp.c
@@ -122,7 +122,7 @@ static int alp_read_header(AVFormatContext *s)
 par->format = AV_SAMPLE_FMT_S16;
 par->sample_rate= hdr->sample_rate;
 
-if (hdr->num_channels > 2)
+if (hdr->num_channels > 2 || hdr->num_channels == 0)
 return AVERROR_INVALIDDATA;
 
 av_channel_layout_default(&par->ch_layout, hdr->num_channels);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/apm: Check channels

2022-03-27 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Mar 20 00:01:16 2022 +0100| [8173a6c130cae04d947fa76007cddfdc591f2583] | 
committer: Michael Niedermayer

avformat/apm: Check channels

Fixes: division by 0
Fixes: 
45643/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-495905188864.fuzz

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8173a6c130cae04d947fa76007cddfdc591f2583
---

 libavformat/apm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/apm.c b/libavformat/apm.c
index 91eea86a57..baf7d2f941 100644
--- a/libavformat/apm.c
+++ b/libavformat/apm.c
@@ -140,7 +140,7 @@ static int apm_read_header(AVFormatContext *s)
 if (par->bits_per_coded_sample != 4)
 return AVERROR_INVALIDDATA;
 
-if (channels > 2)
+if (channels > 2 || channels == 0)
 return AVERROR_INVALIDDATA;
 
 av_channel_layout_default(&par->ch_layout, channels);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avformat/aqtitledec: Skip unrepresentable durations

2022-03-27 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sun 
Mar 20 00:07:50 2022 +0100| [c2d1597a8a6470045a8da241d4f65c81f26c3107] | 
committer: Michael Niedermayer

avformat/aqtitledec: Skip unrepresentable durations

Fixes: signed integer overflow: -5 - 9223372036854775807 cannot be represented 
in type 'long'
Fixes: 
45665/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-475618463934054

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2d1597a8a6470045a8da241d4f65c81f26c3107
---

 libavformat/aqtitledec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/aqtitledec.c b/libavformat/aqtitledec.c
index a37c9bbeaf..6c14b23862 100644
--- a/libavformat/aqtitledec.c
+++ b/libavformat/aqtitledec.c
@@ -74,7 +74,8 @@ static int aqt_read_header(AVFormatContext *s)
 new_event = 1;
 pos = avio_tell(s->pb);
 if (sub) {
-sub->duration = frame - sub->pts;
+if (frame >= sub->pts && (uint64_t)frame - sub->pts < 
INT64_MAX)
+sub->duration = frame - sub->pts;
 sub = NULL;
 }
 } else if (*line) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avfilter/buffersrc: uninitialize the context ch_layout before overwritting it

2022-03-27 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Mar 22 18:30:41 
2022 -0300| [4a8f932fd913d24aa46c9b5784b6e4980567c3ea] | committer: James Almer

avfilter/buffersrc: uninitialize the context ch_layout before overwritting it

av_buffersrc_parameters_set() can be called to set paramenters after the filter
was initialized with for example avfilter_graph_create_filter().

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a8f932fd913d24aa46c9b5784b6e4980567c3ea
---

 libavfilter/buffersrc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index c8521d41b5..a3190468bb 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -132,6 +132,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
 // if the old/new fields are set inconsistently, prefer the old ones
 if (param->channel_layout && (param->ch_layout.order != 
AV_CHANNEL_ORDER_NATIVE ||
   param->ch_layout.u.mask != 
param->channel_layout)) {
+av_channel_layout_uninit(&s->ch_layout);
 av_channel_layout_from_mask(&s->ch_layout, param->channel_layout);
 FF_ENABLE_DEPRECATION_WARNINGS
 } else

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] swresample/rematrix: fix typo in clean_layout()

2022-03-27 Thread James Almer
ffmpeg | branch: master | James Almer  | Mon Mar 28 00:07:33 
2022 -0300| [5ee198f9aae40681de2735260465d47c64b53feb] | committer: James Almer

swresample/rematrix: fix typo in clean_layout()

av_channel_layout_index_from_channel() takes an AVChannel value, not a mask.

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ee198f9aae40681de2735260465d47c64b53feb
---

 libswresample/rematrix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 37e8c2ef4b..5e89b878dd 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -114,7 +114,7 @@ static int clean_layout(AVChannelLayout *out, const 
AVChannelLayout *in, void *s
 {
 int ret = 0;
 
-if(av_channel_layout_index_from_channel(in, AV_CH_FRONT_CENTER) < 0 && 
in->nb_channels == 1) {
+if (av_channel_layout_index_from_channel(in, AV_CHAN_FRONT_CENTER) < 0 && 
in->nb_channels == 1) {
 char buf[128];
 av_channel_layout_describe(in, buf, sizeof(buf));
 av_log(s, AV_LOG_VERBOSE, "Treating %s as mono\n", buf);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".