[FFmpeg-devel] [PATCH] avcodec: parse options from AVCodec.bsfs

James Almer jamrial at gmail.com
Thu Jul 19 22:03:14 EEST 2018


On 7/19/2018 3:44 PM, Carl Eugen Hoyos wrote:
> 2018-07-19 3:37 GMT+02:00, James Almer <jamrial at gmail.com>:
>> On 7/18/2018 3:57 PM, Aman Gupta wrote:
> 
>>> +            ret = av_opt_set_from_string(s->bsfs[s->nb_bsfs -
>>> 1]->priv_data, bsf_options_str, shorthand, "=", ":");
>>> +            if (ret < 0) {
>>> +                av_log(avctx, AV_LOG_ERROR, "Invalid options for
>>> bitstream filter %s "
>>> +                       "requested by the decoder. This is a bug, please
>>> report it.\n",
>>> +                       bsf_name);
>>> +                av_freep(&bsf);
>>> +                ret = AVERROR_BUG;
>>> +                goto fail;
>>> +            }
>>
>> As i said on IRC, av_opt_set_from_string() can return ENOMEM which is
>> not a bug in the string contents, so do something like
>>
>> if (ret < 0) {
>>   if (ret != AVERROR(ENOMEM)) {
>>     av_log(avctx, AV_LOG_ERROR, "Invalid options for bitstream filter %s "
>>            "requested by the decoder. This is a bug, please report it.\n",
>>            bsf_name);
>>     ret = AVERROR_BUG;
> 
> av_assert(ret == AVERROR(ENOMEM)); ?
> 
> Carl Eugen

This is more in line with the similar error above. Aborting gracefully
by printing a message and returning an error value instead of a hard
abort() with no explanation as to why "ret == AVERROR(ENOMEM)" was expected.


More information about the ffmpeg-devel mailing list