- check ret < 0
- remove excessive error log
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -570,10 +570,8 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
570 | 570 |
} |
571 | 571 |
start_ch += chans; |
572 | 572 |
} |
573 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, 8192 * s->channels))) { |
|
574 |
- av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); |
|
573 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 8192 * s->channels)) < 0) |
|
575 | 574 |
return ret; |
576 |
- } |
|
577 | 575 |
do { |
578 | 576 |
int frame_bits; |
579 | 577 |
|
... | ... |
@@ -435,7 +435,7 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, |
435 | 435 |
|
436 | 436 |
ff_ac3_quantize_mantissas(s); |
437 | 437 |
|
438 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size))) |
|
438 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size)) < 0) |
|
439 | 439 |
return ret; |
440 | 440 |
ff_ac3_output_frame(s, avpkt->data); |
441 | 441 |
|
... | ... |
@@ -494,7 +494,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
494 | 494 |
pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8; |
495 | 495 |
else |
496 | 496 |
pkt_size = avctx->block_align; |
497 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size))) |
|
497 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size)) < 0) |
|
498 | 498 |
return ret; |
499 | 499 |
dst = avpkt->data; |
500 | 500 |
|
... | ... |
@@ -613,7 +613,7 @@ static int alac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
613 | 613 |
else |
614 | 614 |
max_frame_size = s->max_coded_frame_size; |
615 | 615 |
|
616 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size))) |
|
616 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * max_frame_size)) < 0) |
|
617 | 617 |
return ret; |
618 | 618 |
|
619 | 619 |
/* use verbatim mode for compression_level 0 */ |
... | ... |
@@ -497,7 +497,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
497 | 497 |
const int16_t *samples; |
498 | 498 |
int ret, real_channel = 0; |
499 | 499 |
|
500 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, DCA_MAX_FRAME_SIZE + DCA_HEADER_SIZE))) |
|
500 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, DCA_MAX_FRAME_SIZE + DCA_HEADER_SIZE)) < 0) |
|
501 | 501 |
return ret; |
502 | 502 |
|
503 | 503 |
samples = (const int16_t *)frame->data[0]; |
... | ... |
@@ -1276,7 +1276,7 @@ static int flac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
1276 | 1276 |
} |
1277 | 1277 |
} |
1278 | 1278 |
|
1279 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, frame_bytes))) |
|
1279 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, frame_bytes)) < 0) |
|
1280 | 1280 |
return ret; |
1281 | 1281 |
|
1282 | 1282 |
out_bytes = write_frame(s, avpkt); |
... | ... |
@@ -368,7 +368,7 @@ static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
368 | 368 |
int nb_samples, out_size, ret; |
369 | 369 |
|
370 | 370 |
out_size = (frame->nb_samples + 1) / 2; |
371 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) |
|
371 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0) |
|
372 | 372 |
return ret; |
373 | 373 |
|
374 | 374 |
nb_samples = frame->nb_samples - (frame->nb_samples & 1); |
... | ... |
@@ -2458,7 +2458,7 @@ static int g723_1_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
2458 | 2458 |
offset += LPC_ORDER; |
2459 | 2459 |
} |
2460 | 2460 |
|
2461 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, 24))) |
|
2461 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 24)) < 0) |
|
2462 | 2462 |
return ret; |
2463 | 2463 |
|
2464 | 2464 |
*got_packet_ptr = 1; |
... | ... |
@@ -362,7 +362,7 @@ static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
362 | 362 |
int i, ret, out_size; |
363 | 363 |
|
364 | 364 |
out_size = (frame->nb_samples * c->code_size + 7) / 8; |
365 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, out_size))) |
|
365 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0) |
|
366 | 366 |
return ret; |
367 | 367 |
init_put_bits(&pb, avpkt->data, avpkt->size); |
368 | 368 |
|
... | ... |
@@ -104,7 +104,7 @@ static int aacPlus_encode_frame(AVCodecContext *avctx, AVPacket *pkt, |
104 | 104 |
int32_t *input_buffer = (int32_t *)frame->data[0]; |
105 | 105 |
int ret; |
106 | 106 |
|
107 |
- if ((ret = ff_alloc_packet2(avctx, pkt, s->max_output_bytes))) |
|
107 |
+ if ((ret = ff_alloc_packet2(avctx, pkt, s->max_output_bytes)) < 0) |
|
108 | 108 |
return ret; |
109 | 109 |
|
110 | 110 |
pkt->size = aacplusEncEncode(s->aacplus_handle, input_buffer, |
... | ... |
@@ -184,10 +184,8 @@ static int Faac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
184 | 184 |
int num_samples = frame ? frame->nb_samples : 0; |
185 | 185 |
void *samples = frame ? frame->data[0] : NULL; |
186 | 186 |
|
187 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels))) { |
|
188 |
- av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n"); |
|
187 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, (7 + 768) * avctx->channels)) < 0) |
|
189 | 188 |
return ret; |
190 |
- } |
|
191 | 189 |
|
192 | 190 |
bytes_written = faacEncEncode(s->faac_handle, samples, |
193 | 191 |
num_samples * avctx->channels, |
... | ... |
@@ -339,7 +339,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
339 | 339 |
} |
340 | 340 |
|
341 | 341 |
/* The maximum packet size is 6144 bits aka 768 bytes per channel. */ |
342 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels)))) |
|
342 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels))) < 0) |
|
343 | 343 |
return ret; |
344 | 344 |
|
345 | 345 |
out_ptr = avpkt->data; |
... | ... |
@@ -107,7 +107,7 @@ static int libgsm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
107 | 107 |
gsm_signal *samples = (gsm_signal *)frame->data[0]; |
108 | 108 |
struct gsm_state *state = avctx->priv_data; |
109 | 109 |
|
110 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align))) |
|
110 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, avctx->block_align)) < 0) |
|
111 | 111 |
return ret; |
112 | 112 |
|
113 | 113 |
switch(avctx->codec_id) { |
... | ... |
@@ -254,7 +254,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
254 | 254 |
av_dlog(avctx, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len, |
255 | 255 |
s->buffer_index); |
256 | 256 |
if (len <= s->buffer_index) { |
257 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, len))) |
|
257 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, len)) < 0) |
|
258 | 258 |
return ret; |
259 | 259 |
memcpy(avpkt->data, s->buffer, len); |
260 | 260 |
s->buffer_index -= len; |
... | ... |
@@ -247,7 +247,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
247 | 247 |
s->enc_bitrate = avctx->bit_rate; |
248 | 248 |
} |
249 | 249 |
|
250 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, 32))) |
|
250 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 32)) < 0) |
|
251 | 251 |
return ret; |
252 | 252 |
|
253 | 253 |
if (frame) { |
... | ... |
@@ -304,7 +304,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
304 | 304 |
/* write output if all frames for the packet have been encoded */ |
305 | 305 |
if (s->pkt_frame_count == s->frames_per_packet) { |
306 | 306 |
s->pkt_frame_count = 0; |
307 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, speex_bits_nbytes(&s->bits)))) |
|
307 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, speex_bits_nbytes(&s->bits))) < 0) |
|
308 | 308 |
return ret; |
309 | 309 |
ret = speex_bits_write(&s->bits, avpkt->data, avpkt->size); |
310 | 310 |
speex_bits_reset(&s->bits); |
... | ... |
@@ -94,7 +94,7 @@ static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
94 | 94 |
TWOLAMEContext *s = avctx->priv_data; |
95 | 95 |
int ret; |
96 | 96 |
|
97 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE))) |
|
97 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE)) < 0) |
|
98 | 98 |
return ret; |
99 | 99 |
|
100 | 100 |
if (frame) { |
... | ... |
@@ -161,7 +161,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
161 | 161 |
return ret; |
162 | 162 |
} |
163 | 163 |
|
164 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels)))) |
|
164 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels))) < 0) |
|
165 | 165 |
return ret; |
166 | 166 |
|
167 | 167 |
input.Buffer = samples; |
... | ... |
@@ -121,7 +121,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
121 | 121 |
const int16_t *samples = (const int16_t *)frame->data[0]; |
122 | 122 |
int size, ret; |
123 | 123 |
|
124 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE))) |
|
124 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE)) < 0) |
|
125 | 125 |
return ret; |
126 | 126 |
|
127 | 127 |
if (s->last_bitrate != avctx->bit_rate) { |
... | ... |
@@ -348,7 +348,7 @@ static int oggvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
348 | 348 |
|
349 | 349 |
av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL); |
350 | 350 |
|
351 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes))) |
|
351 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, op.bytes)) < 0) |
|
352 | 352 |
return ret; |
353 | 353 |
av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL); |
354 | 354 |
|
... | ... |
@@ -754,7 +754,7 @@ static int MPA_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
754 | 754 |
} |
755 | 755 |
compute_bit_allocation(s, smr, bit_alloc, &padding); |
756 | 756 |
|
757 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE))) |
|
757 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, MPA_MAX_CODED_FRAME_SIZE)) < 0) |
|
758 | 758 |
return ret; |
759 | 759 |
|
760 | 760 |
init_put_bits(&s->pb, avpkt->data, avpkt->size); |
... | ... |
@@ -401,7 +401,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
401 | 401 |
s->last_frame = 1; |
402 | 402 |
} |
403 | 403 |
|
404 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, NELLY_BLOCK_LEN))) |
|
404 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, NELLY_BLOCK_LEN)) < 0) |
|
405 | 405 |
return ret; |
406 | 406 |
encode_block(s, avpkt->data, avpkt->size); |
407 | 407 |
|
... | ... |
@@ -107,7 +107,7 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
107 | 107 |
n = frame->nb_samples * avctx->channels; |
108 | 108 |
samples = (const short *)frame->data[0]; |
109 | 109 |
|
110 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size))) |
|
110 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size)) < 0) |
|
111 | 111 |
return ret; |
112 | 112 |
dst = avpkt->data; |
113 | 113 |
|
... | ... |
@@ -458,7 +458,7 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
458 | 458 |
if (ractx->last_frame) |
459 | 459 |
return 0; |
460 | 460 |
|
461 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE))) |
|
461 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, FRAMESIZE)) < 0) |
|
462 | 462 |
return ret; |
463 | 463 |
|
464 | 464 |
/** |
... | ... |
@@ -173,7 +173,7 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
173 | 173 |
else |
174 | 174 |
data_size = avctx->channels * avctx->frame_size; |
175 | 175 |
|
176 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size))) |
|
176 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size)) < 0) |
|
177 | 177 |
return ret; |
178 | 178 |
out = avpkt->data; |
179 | 179 |
|
... | ... |
@@ -632,7 +632,7 @@ static int sonic_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
632 | 632 |
int ret; |
633 | 633 |
const short *samples = (const int16_t*)frame->data[0]; |
634 | 634 |
|
635 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size * 5 + 1000))) |
|
635 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size * 5 + 1000)) < 0) |
|
636 | 636 |
return ret; |
637 | 637 |
|
638 | 638 |
init_put_bits(&pb, avpkt->data, avpkt->size); |
... | ... |
@@ -1028,7 +1028,7 @@ static int vorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, |
1028 | 1028 |
return 0; |
1029 | 1029 |
samples = 1 << (venc->log2_blocksize[0] - 1); |
1030 | 1030 |
|
1031 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, 8192))) |
|
1031 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 8192)) < 0) |
|
1032 | 1032 |
return ret; |
1033 | 1033 |
|
1034 | 1034 |
init_put_bits(&pb, avpkt->data, avpkt->size); |
... | ... |
@@ -366,7 +366,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt, |
366 | 366 |
} |
367 | 367 |
} |
368 | 368 |
|
369 |
- if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE))) |
|
369 |
+ if ((ret = ff_alloc_packet2(avctx, avpkt, 2 * MAX_CODED_SUPERFRAME_SIZE)) < 0) |
|
370 | 370 |
return ret; |
371 | 371 |
|
372 | 372 |
total_gain= 128; |