On 08/09/16 11:33, Hendrik Leppkes wrote:
> On Thu, Sep 8, 2016 at 7:17 AM, Anton Khirnov <[email protected]> wrote:
>> Quoting Mark Thompson (2016-09-06 22:53:18)
>>> @@ -2480,6 +2514,20 @@ int vp78_decode_frame(AVCodecContext *avctx, void 
>>> *data, int *got_frame,
>>>      if (ret < 0)
>>>          goto err;
>>>
>>> +    if (!is_vp7 && s->pix_fmt == AV_PIX_FMT_NONE) {
>>> +        enum AVPixelFormat pix_fmts[] = {
>>> +            AV_PIX_FMT_YUV420P,
>>> +            AV_PIX_FMT_NONE,
>>> +        };
>>> +
>>> +        s->pix_fmt = ff_get_format(s->avctx, pix_fmts);
>>> +        if (s->pix_fmt < 0) {
>>> +            ret = AVERROR_BUG;
>>
>> AVERROR_BUG is meant to be used in cases that should not happen in valid
>> code, it's like a "soft assert".
>> Since it's perfectly valid for ff_get_format() to fail, you should
>> instead use something like AVERROR_UNKNOWN.
> 
> Doesn't ff_get_format return an error code which he could/should just forward?

No?  ff_get_format() doesn't return any error codes directly.  If the
get_format() callback returns one then that is a bug because it gets assigned to
an enum AVPixelFormat (which is signed and need not be able to represent all of
int, hence undefined behaviour).

- Mark

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to