++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)
if ((m4af = m4af_create(M4AF_CODEC_MP4A, scale, &m4af_io,
params.output_fp)) < 0)
goto END;
+ m4af_set_num_channels(m4af, 0, sample_format->channels_per_frame);
m4af_set_decoder_specific_info(m4af, 0,
aacinfo.confBuf, aacinfo.confSize);
m4af_set_fixed_frame_duration(m4af, 0, framelen >> scale_shift);