diff options
-rw-r--r-- | firmware/mpeg.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index dae0ef4d41..48da48177f 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -243,6 +243,7 @@ void DEI3(void) | |||
243 | 243 | ||
244 | if(!filling && unplayed_space_left < MPEG_LOW_WATER) | 244 | if(!filling && unplayed_space_left < MPEG_LOW_WATER) |
245 | { | 245 | { |
246 | filling = true; | ||
246 | queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); | 247 | queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); |
247 | } | 248 | } |
248 | 249 | ||
@@ -354,7 +355,7 @@ static void mpeg_thread(void) | |||
354 | read too large chunks because the bitswapping will take | 355 | read too large chunks because the bitswapping will take |
355 | too much time. We must keep the DMA happy and also give | 356 | too much time. We must keep the DMA happy and also give |
356 | the other threads a chance to run. */ | 357 | the other threads a chance to run. */ |
357 | if(filling) | 358 | if(mpeg_file >= 0) |
358 | { | 359 | { |
359 | DEBUGF("R\n"); | 360 | DEBUGF("R\n"); |
360 | len = read(mpeg_file, mp3buf+mp3buf_write, amount_to_read); | 361 | len = read(mpeg_file, mp3buf+mp3buf_write, amount_to_read); |
@@ -387,6 +388,7 @@ static void mpeg_thread(void) | |||
387 | else | 388 | else |
388 | { | 389 | { |
389 | close(mpeg_file); | 390 | close(mpeg_file); |
391 | mpeg_file = -1; | ||
390 | 392 | ||
391 | /* Make sure that the write pointer is at a word | 393 | /* Make sure that the write pointer is at a word |
392 | boundary */ | 394 | boundary */ |
@@ -542,7 +544,7 @@ void mpeg_init(void) | |||
542 | rc = mas_run(1); | 544 | rc = mas_run(1); |
543 | if (rc < 0) | 545 | if (rc < 0) |
544 | panicf("Error - mas_run(1) returned %d\n", rc); | 546 | panicf("Error - mas_run(1) returned %d\n", rc); |
545 | 547 | ||
546 | queue_init(&mpeg_queue); | 548 | queue_init(&mpeg_queue); |
547 | create_thread(mpeg_thread, mpeg_stack, sizeof(mpeg_stack)); | 549 | create_thread(mpeg_thread, mpeg_stack, sizeof(mpeg_stack)); |
548 | mas_poll_start(2); | 550 | mas_poll_start(2); |