Message ID | 20170706182842.7785-8-derek.buitenhuis@gmail.com |
---|---|
State | New |
Headers | show |
On 6 July 2017 at 19:28, Derek Buitenhuis <derek.buitenhuis@gmail.com> wrote: > Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> > --- > libavcodec/cngenc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavcodec/cngenc.c b/libavcodec/cngenc.c > index 302c703f72..b7207fd5f6 100644 > --- a/libavcodec/cngenc.c > +++ b/libavcodec/cngenc.c > @@ -92,6 +92,8 @@ static int cng_encode_frame(AVCodecContext *avctx, > AVPacket *avpkt, > qdbov = 127; > } > ret = ff_lpc_calc_ref_coefs(&p->lpc, p->samples32, p->order, > p->ref_coef); > + if (ret < 0) > + return ret; > avpkt->data[0] = qdbov; > for (i = 0; i < p->order; i++) > avpkt->data[1 + i] = p->ref_coef[i] * 127 + 127; > -- > 2.11.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > Just remove setting and checking the return value altogether, ff_lpc_calc_ref_coeffs returns the order which you give it and can't error out. Would look good to me if you did that, so feel free to push once done.
On 7/6/2017 10:07 PM, Rostislav Pehlivanov wrote: > Just remove setting and checking the return value altogether, > ff_lpc_calc_ref_coeffs returns the order which you give it and can't error > out. Would look good to me if you did that, so feel free to push once done. OK. - Derek
diff --git a/libavcodec/cngenc.c b/libavcodec/cngenc.c index 302c703f72..b7207fd5f6 100644 --- a/libavcodec/cngenc.c +++ b/libavcodec/cngenc.c @@ -92,6 +92,8 @@ static int cng_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, qdbov = 127; } ret = ff_lpc_calc_ref_coefs(&p->lpc, p->samples32, p->order, p->ref_coef); + if (ret < 0) + return ret; avpkt->data[0] = qdbov; for (i = 0; i < p->order; i++) avpkt->data[1 + i] = p->ref_coef[i] * 127 + 127;
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> --- libavcodec/cngenc.c | 2 ++ 1 file changed, 2 insertions(+)