On 25/04/14 20:19, Alessandro Ghedini wrote:
> On ven, apr 25, 2014 at 07:48:12 +0200, Luca Barbato wrote:
>> On 25/04/14 19:31, Alessandro Ghedini wrote:
>>> +static av_cold int init(AVFilterContext *ctx)
>>> +{
>>> +    Bs2bContext *bs2b = ctx->priv;
>>> +
>>> +    if (!(bs2b->bs2bp = bs2b_open()))
>>> +        return -1;
>>
>> AVERROR_UNKNOWN or maybe AVERROR(ENOMEM) ?
> 
> ENOMEM sounds good.
> 
>>> +static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
>>> +{
>>> +    int ret;
>>> +    AVFrame *out_buf;
>>> +
>>> +    Bs2bContext     *bs2b = inlink->dst->priv;
>>> +    AVFilterLink *outlink = inlink->dst->outputs[0];
>>> +
>>> +    if (av_frame_is_writable(buf)) {
>>> +        out_buf = buf;
>>> +    } else {
>>> +        out_buf = ff_get_audio_buffer(inlink, buf->nb_samples);
>>> +        if (!out_buf)
>>> +            return AVERROR(ENOMEM);
>>> +        ret = av_frame_copy_props(out_buf, buf);
>>> +        if (ret < 0) {
>>> +            av_frame_free(&out_buf);
>>> +            av_frame_free(&buf);
>>
>> Not sure about this free, if you could fix it and the other small issues
>> below would be great.
> 
> FWIW I copied that code from af_volume.c, so that may need fixing too.
> 
> Also, I just noticed that af_volume also has:
> 
>     if (buf != out_buf)
>         av_frame_free(&buf);
> 
> just before returning (without errors). Should I add that here too? Maybe it'd
> be enough to move that last free() after the if (ret < 0).

Anton could you please shed some light on that? I'll write some notes
about it in the wiki...

lu


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

Reply via email to