mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Simplify verbatim mode fallback by checking the frame size before writing.
Originally committed as revision 24632 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
2249a7f312
commit
3d2cd42f8a
@ -1285,23 +1285,19 @@ static int flac_encode_frame(AVCodecContext *avctx, uint8_t *frame,
|
||||
channel_decorrelation(s);
|
||||
|
||||
frame_bytes = encode_frame(s);
|
||||
if (buf_size < frame_bytes) {
|
||||
av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
|
||||
return 0;
|
||||
}
|
||||
out_bytes = write_frame(s, frame, buf_size);
|
||||
|
||||
/* fallback to verbatim mode if the compressed frame is larger than it
|
||||
would be if encoded uncompressed. */
|
||||
if (out_bytes > s->max_framesize) {
|
||||
if (frame_bytes > s->max_framesize) {
|
||||
s->frame.verbatim_only = 1;
|
||||
frame_bytes = encode_frame(s);
|
||||
}
|
||||
|
||||
if (buf_size < frame_bytes) {
|
||||
av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
|
||||
return 0;
|
||||
}
|
||||
out_bytes = write_frame(s, frame, buf_size);
|
||||
}
|
||||
|
||||
s->frame_count++;
|
||||
avctx->coded_frame->pts = s->sample_count;
|
||||
|
Loading…
Reference in New Issue
Block a user