diff mbox series

[FFmpeg-devel] avformat/utils: do not fallback to av1dec for probing

Message ID 20201006133641.22931-1-timo@rothenpieler.org
State New
Headers show
Series [FFmpeg-devel] avformat/utils: do not fallback to av1dec for probing
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Timo Rothenpieler Oct. 6, 2020, 1:36 p.m. UTC
---
 libavformat/utils.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Nicolas George Oct. 6, 2020, 1:38 p.m. UTC | #1
Timo Rothenpieler (12020-10-06):
> ---
>  libavformat/utils.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index a2e701ea1a..871e655e13 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -222,6 +222,10 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
>          while ((probe_codec = av_codec_iterate(&iter))) {
>              if (probe_codec->id == codec->id &&
>                      av_codec_is_decoder(probe_codec) &&
> +                    /* The av1 "decoder" exists purely for hwaccel purposes.
> +                     * It cannot probe on its own and causes an error if it tries.
> +                     * Remove this check if av1dec ever gains software decode support. */
> +                    strcmp(probe_codec->name, "av1") &&
>                      !(probe_codec->capabilities & (AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_EXPERIMENTAL))) {
>                  return probe_codec;
>              }

Is this not what AV_CODEC_CAP_AVOID_PROBING is for?

Regards,
Timo Rothenpieler Oct. 6, 2020, 1:47 p.m. UTC | #2
On 06.10.2020 15:38, Nicolas George wrote:
> Timo Rothenpieler (12020-10-06):
>> ---
>>   libavformat/utils.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index a2e701ea1a..871e655e13 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -222,6 +222,10 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
>>           while ((probe_codec = av_codec_iterate(&iter))) {
>>               if (probe_codec->id == codec->id &&
>>                       av_codec_is_decoder(probe_codec) &&
>> +                    /* The av1 "decoder" exists purely for hwaccel purposes.
>> +                     * It cannot probe on its own and causes an error if it tries.
>> +                     * Remove this check if av1dec ever gains software decode support. */
>> +                    strcmp(probe_codec->name, "av1") &&
>>                       !(probe_codec->capabilities & (AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_EXPERIMENTAL))) {
>>                   return probe_codec;
>>               }
> 
> Is this not what AV_CODEC_CAP_AVOID_PROBING is for?
> 
> Regards,

No it's not. You want av1dec to be used for probing, but only if it's 
the actual hwaccel decoder.
You never want it to be used for probing in any other case.
Which is pretty much the opposite of AV_CODEC_CAP_AVOID_PROBING.

So this either needs a new AV_CODEC_CAP_ flag, or code like this.
Given how unique the situation is for this specific decoder shim, and 
that it will likely gain software decode support eventually, this seems 
more appropiate to me.

The background to this is that with AV1 enabled cuviddec, which has 
rightfully set AV_CODEC_CAP_AVOID_PROBING on it, find_probe_decoder 
tries to probe via av1dec, which then fails because av1dec has no 
hwaccel set on it.

The same would happen with any other av1 decoder with 
AV_CODEC_CAP_AVOID_PROBING set on it.
Timo Rothenpieler Oct. 6, 2020, 2:33 p.m. UTC | #3
Made obsolete via 214998c55ff99586b57c1ccd34a7e6f15c4fcdb8
diff mbox series

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index a2e701ea1a..871e655e13 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -222,6 +222,10 @@  static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st,
         while ((probe_codec = av_codec_iterate(&iter))) {
             if (probe_codec->id == codec->id &&
                     av_codec_is_decoder(probe_codec) &&
+                    /* The av1 "decoder" exists purely for hwaccel purposes.
+                     * It cannot probe on its own and causes an error if it tries.
+                     * Remove this check if av1dec ever gains software decode support. */
+                    strcmp(probe_codec->name, "av1") &&
                     !(probe_codec->capabilities & (AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_EXPERIMENTAL))) {
                 return probe_codec;
             }