X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fnoise_bsf.c;h=6ebd36963326a75ad0fb146e2d19ce6ed643add6;hb=d40bb518b50561db60ef71ab0e37eb7f3fb9043b;hp=d79f63b77797e5e0c6fce2c1d2f71d5a26a429b0;hpb=ace96d2e693d804a0ed16aebc1b1027cfff2c527;p=ffmpeg diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index d79f63b7779..6ebd3696332 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -19,13 +19,11 @@ */ #include -#include -#include "avcodec.h" #include "bsf.h" +#include "bsf_internal.h" #include "libavutil/log.h" -#include "libavutil/mem.h" #include "libavutil/opt.h" typedef struct NoiseContext { @@ -39,7 +37,7 @@ static int noise(AVBSFContext *ctx, AVPacket *pkt) { NoiseContext *s = ctx->priv_data; int amount = s->amount > 0 ? s->amount : (s->state % 10001 + 1); - int i, ret = 0; + int i, ret; if (amount <= 0) return AVERROR(EINVAL); @@ -55,19 +53,18 @@ static int noise(AVBSFContext *ctx, AVPacket *pkt) } ret = av_packet_make_writable(pkt); - if (ret < 0) - goto fail; + if (ret < 0) { + av_packet_unref(pkt); + return ret; + } for (i = 0; i < pkt->size; i++) { s->state += pkt->data[i] + 1; if (s->state % amount == 0) pkt->data[i] = s->state; } -fail: - if (ret < 0) - av_packet_unref(pkt); - return ret; + return 0; } #define OFFSET(x) offsetof(NoiseContext, x)