diff options
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index b39f318ec3..440bbd721d 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -929,7 +929,6 @@ static inline int32_t clip_sample(int32_t sample) | |||
929 | return sample; | 929 | return sample; |
930 | } | 930 | } |
931 | 931 | ||
932 | static void audio_thread(void) __attribute__((noreturn)); | ||
933 | static void audio_thread(void) | 932 | static void audio_thread(void) |
934 | { | 933 | { |
935 | uint8_t *mpabuf = mpa_buffer; | 934 | uint8_t *mpabuf = mpa_buffer; |
@@ -1197,12 +1196,10 @@ done: | |||
1197 | rb->sleep(HZ/4); | 1196 | rb->sleep(HZ/4); |
1198 | } | 1197 | } |
1199 | 1198 | ||
1200 | /* Don't really terminate but just signal that it's ok for this thread | 1199 | pcm_playback_stop(); |
1201 | to be killed */ | ||
1202 | audiostatus = THREAD_TERMINATED; | ||
1203 | 1200 | ||
1204 | while (1) | 1201 | audiostatus = THREAD_TERMINATED; |
1205 | rb->yield(); | 1202 | rb->remove_thread(NULL); |
1206 | } | 1203 | } |
1207 | 1204 | ||
1208 | /* End of libmad stuff */ | 1205 | /* End of libmad stuff */ |
@@ -1744,20 +1741,21 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
1744 | #endif | 1741 | #endif |
1745 | 1742 | ||
1746 | /* Stop the threads and wait for them to terminate */ | 1743 | /* Stop the threads and wait for them to terminate */ |
1747 | if (audiothread_id != NULL) | 1744 | if (videostatus != THREAD_TERMINATED) |
1748 | audiostatus = PLEASE_STOP; | 1745 | { |
1749 | |||
1750 | if (videothread_id != NULL) | ||
1751 | videostatus = PLEASE_STOP; | 1746 | videostatus = PLEASE_STOP; |
1747 | while (videostatus != THREAD_TERMINATED) | ||
1748 | rb->yield(); | ||
1749 | } | ||
1752 | 1750 | ||
1753 | while (audiostatus != THREAD_TERMINATED || | 1751 | if (audiostatus != THREAD_TERMINATED) |
1754 | videostatus != THREAD_TERMINATED) | 1752 | { |
1755 | rb->yield(); | 1753 | audiostatus = PLEASE_STOP; |
1756 | 1754 | while (audiostatus != THREAD_TERMINATED) | |
1757 | if (audiothread_id != NULL) | 1755 | rb->yield(); |
1758 | rb->remove_thread(audiothread_id); | 1756 | } |
1759 | 1757 | ||
1760 | pcm_playback_stop(); | 1758 | rb->sleep(HZ/10); |
1761 | 1759 | ||
1762 | rb->lcd_clear_display(); | 1760 | rb->lcd_clear_display(); |
1763 | rb->lcd_update(); | 1761 | rb->lcd_update(); |