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
510 int chan_el_counter[4];510 int chan_el_counter[4];
511 FFPsyWindowInfo windows[AAC_MAX_CHANNELS];511 FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
512 512
513 if (s->last_frame)513 if (s->last_frame == 2)
514 return 0;514 return 0;
515 515
516 if (data) {516 deinterleave_input_samples(s, data, data ? avctx->frame_size : 0);
517 deinterleave_input_samples(s, data, avctx->frame_size);517 if (s->psypp)
518 if (s->psypp)518 ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
519 ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
520 }
521 519
522 if (!avctx->frame_number)520 if (!avctx->frame_number)
523 return 0;521 return 0;
@@ -648,7 +646,7 @@ static int aac_encode_frame(AVCodecContext *avctx, · 124 unmodified lines
648 }646 }
649 647
650 if (!data)648 if (!data)
651 s->last_frame = 1;649 s->last_frame++;
652 650
653 return put_bits_count(&s->pb)>>3;651 return put_bits_count(&s->pb)>>3;
654}652}

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