aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp4_decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mp4_decode.c')
-rw-r--r--src/mp4_decode.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mp4_decode.c b/src/mp4_decode.c
index e9e3d22eb..6ecce1853 100644
--- a/src/mp4_decode.c
+++ b/src/mp4_decode.c
@@ -223,15 +223,6 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
sampleBuffer = faacDecDecode(decoder,&frameInfo,mp4Buffer,
mp4BufferSize);
- if(dc->start) {
- channels = frameInfo.channels;
- scale = frameInfo.samplerate;
- af->channels = frameInfo.channels;
- af->sampleRate = frameInfo.samplerate;
- dc->state = DECODE_STATE_DECODE;
- dc->start = 0;
- }
-
if(mp4Buffer) free(mp4Buffer);
if(frameInfo.error > 0) {
ERROR("error decoding MP4 file: %s\n",dc->file);
@@ -241,6 +232,15 @@ int mp4_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc) {
break;
}
+ if(dc->start) {
+ channels = frameInfo.channels;
+ scale = frameInfo.samplerate;
+ af->channels = frameInfo.channels;
+ af->sampleRate = frameInfo.samplerate;
+ dc->state = DECODE_STATE_DECODE;
+ dc->start = 0;
+ }
+
if(channels*(dur+offset) > frameInfo.samples) {
dur = frameInfo.samples/channels;
offset = 0;