History

aacenc: make sure to encode enough frames to cover all input samples.

Currently, any samples in the final frame are not decoded because they are only represented by one frame instead of two. So we encode two final frames to cover both the analysis delay and the MDCT delay.

Justin Ruggles committed 14 years ago

Commit 89eea6d1 parent f44005b1 file · +5 −7Browse files

Unified · Split

libavcodec/aacenc.c+5−7
@@ -510,14 +510,12 @@ static int aac_encode_frame(AVCodecContext *avctx, · 509 unmodified lines
510510 int chan_el_counter[4];
511511 FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
512512
513− if (s->last_frame)
513+ if (s->last_frame == 2)
514514 return 0;
515515
516− if (data) {
517− deinterleave_input_samples(s, data, avctx->frame_size);
518− if (s->psypp)
519− ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
520− }
516+ deinterleave_input_samples(s, data, data ? avctx->frame_size : 0);
517+ if (s->psypp)
518+ ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
521519
522520 if (!avctx->frame_number)
523521 return 0;
@@ -648,7 +646,7 @@ static int aac_encode_frame(AVCodecContext *avctx, · 124 unmodified lines
648646 }
649647
650648 if (!data)
651− s->last_frame = 1;
649+ s->last_frame++;
652650
653651 return put_bits_count(&s->pb)>>3;
654652 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t