X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=src%2Fmain.c;fp=src%2Fmain.c;h=6ffb7b197cc6228a6fbc5d18d2f9f5fd0433ac98;hb=f75c9c7b3e90df13b91f3de94c6374c58e4c3d52;hp=f4ecd756be0e238a9f6456a2c0a7ee7b09337f4c;hpb=1056e34abed5f7378c0280dfc163131b690144e8;p=fdkaac.git diff --git a/src/main.c b/src/main.c index f4ecd75..6ffb7b1 100644 --- a/src/main.c +++ b/src/main.c @@ -563,11 +563,20 @@ int encode(aacenc_param_ex_t *params, pcm_reader_t *reader, ++encoded; if (encoded == 1 || encoded == 3) continue; - obp = &obuf[flip]; - if (write_sample(params->output_fp, m4af, obp) < 0) + + if (write_sample(params->output_fp, m4af, &obuf[flip]) < 0) goto END; ++frames_written; } while (remaining > 0); + /* + * When interrupted, we haven't pulled out last extrapolated frames + * from the reader. Therefore, we have to write the final outcome. + */ + if (g_interrupted) { + if (write_sample(params->output_fp, m4af, &obp[flip^1]) < 0) + goto END; + ++frames_written; + } } DONE: if (!params->silent)