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

Timo Rothenpieler timo at rothenpieler.org
Tue Oct 6 16:47:15 EEST 2020


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.


More information about the ffmpeg-devel mailing list