summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/buffering.c9
-rw-r--r--apps/codecs.c36
-rw-r--r--apps/codecs.h52
-rw-r--r--apps/debug_menu.c11
-rw-r--r--apps/main.c2
-rw-r--r--apps/pcmbuf.c23
-rw-r--r--apps/playback.c10
-rw-r--r--apps/plugin.c5
-rw-r--r--apps/plugin.h14
-rw-r--r--apps/plugins/mpegplayer/audio_thread.c6
-rw-r--r--apps/plugins/mpegplayer/disk_buf.c4
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.c4
-rw-r--r--apps/plugins/mpegplayer/video_thread.c6
-rw-r--r--apps/voice_thread.c4
14 files changed, 100 insertions, 86 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 64f522c52f..0cb428c947 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -1446,16 +1446,21 @@ void buffering_thread(void)
1446 1446
1447void buffering_init(void) { 1447void buffering_init(void) {
1448 mutex_init(&llist_mutex); 1448 mutex_init(&llist_mutex);
1449#ifdef HAVE_PRIORITY_SCHEDULING
1450 /* This behavior not safe atm */
1451 mutex_set_preempt(&llist_mutex, false);
1452#endif
1449 1453
1450 conf_watermark = BUFFERING_DEFAULT_WATERMARK; 1454 conf_watermark = BUFFERING_DEFAULT_WATERMARK;
1451 1455
1452 queue_init(&buffering_queue, true); 1456 queue_init(&buffering_queue, true);
1453 queue_enable_queue_send(&buffering_queue, &buffering_queue_sender_list);
1454
1455 buffering_thread_p = create_thread( buffering_thread, buffering_stack, 1457 buffering_thread_p = create_thread( buffering_thread, buffering_stack,
1456 sizeof(buffering_stack), CREATE_THREAD_FROZEN, 1458 sizeof(buffering_stack), CREATE_THREAD_FROZEN,
1457 buffering_thread_name IF_PRIO(, PRIORITY_BUFFERING) 1459 buffering_thread_name IF_PRIO(, PRIORITY_BUFFERING)
1458 IF_COP(, CPU)); 1460 IF_COP(, CPU));
1461
1462 queue_enable_queue_send(&buffering_queue, &buffering_queue_sender_list,
1463 buffering_thread_p);
1459} 1464}
1460 1465
1461/* Initialise the buffering subsystem */ 1466/* Initialise the buffering subsystem */
diff --git a/apps/codecs.c b/apps/codecs.c
index dfae463865..f2c74522cc 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -76,6 +76,7 @@ struct codec_api ci = {
76 false, /* stop_codec */ 76 false, /* stop_codec */
77 0, /* new_track */ 77 0, /* new_track */
78 0, /* seek_time */ 78 0, /* seek_time */
79 NULL, /* struct dsp_config *dsp */
79 NULL, /* get_codec_memory */ 80 NULL, /* get_codec_memory */
80 NULL, /* pcmbuf_insert */ 81 NULL, /* pcmbuf_insert */
81 NULL, /* set_elapsed */ 82 NULL, /* set_elapsed */
@@ -95,6 +96,23 @@ struct codec_api ci = {
95 PREFIX(sleep), 96 PREFIX(sleep),
96 yield, 97 yield,
97 98
99#if NUM_CORES > 1
100 create_thread,
101 thread_thaw,
102 thread_wait,
103 semaphore_init,
104 semaphore_wait,
105 semaphore_release,
106 event_init,
107 event_wait,
108 event_set_state,
109#endif
110
111#ifdef CACHE_FUNCTIONS_AS_CALL
112 flush_icache,
113 invalidate_icache,
114#endif
115
98 /* strings and memory */ 116 /* strings and memory */
99 strcpy, 117 strcpy,
100 strncpy, 118 strncpy,
@@ -147,24 +165,6 @@ struct codec_api ci = {
147 /* new stuff at the end, sort into place next time 165 /* new stuff at the end, sort into place next time
148 the API gets incompatible */ 166 the API gets incompatible */
149 167
150#ifdef CACHE_FUNCTIONS_AS_CALL
151 flush_icache,
152 invalidate_icache,
153#endif
154
155 NULL, /* struct dsp_config *dsp */
156
157#if NUM_CORES > 1
158 create_thread,
159 thread_thaw,
160 thread_wait,
161 semaphore_init,
162 semaphore_wait,
163 semaphore_release,
164 event_init,
165 event_wait,
166 event_set_state,
167#endif
168}; 168};
169 169
170void codec_get_full_path(char *path, const char *codec_root_fn) 170void codec_get_full_path(char *path, const char *codec_root_fn)
diff --git a/apps/codecs.h b/apps/codecs.h
index ad6b831b61..fb5675fd84 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -80,12 +80,12 @@
80#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ 80#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
81 81
82/* increase this every time the api struct changes */ 82/* increase this every time the api struct changes */
83#define CODEC_API_VERSION 22 83#define CODEC_API_VERSION 23
84 84
85/* update this to latest version if a change to the api struct breaks 85/* update this to latest version if a change to the api struct breaks
86 backwards compatibility (and please take the opportunity to sort in any 86 backwards compatibility (and please take the opportunity to sort in any
87 new function which are "waiting" at the end of the function table) */ 87 new function which are "waiting" at the end of the function table) */
88#define CODEC_MIN_API_VERSION 22 88#define CODEC_MIN_API_VERSION 23
89 89
90/* codec return codes */ 90/* codec return codes */
91enum codec_status { 91enum codec_status {
@@ -118,6 +118,9 @@ struct codec_api {
118 /* If seek_time != 0, codec should seek to that song position (in ms) 118 /* If seek_time != 0, codec should seek to that song position (in ms)
119 if codec supports seeking. */ 119 if codec supports seeking. */
120 long seek_time; 120 long seek_time;
121
122 /* The dsp instance to be used for audio output */
123 struct dsp_config *dsp;
121 124
122 /* Returns buffer to malloc array. Only codeclib should need this. */ 125 /* Returns buffer to malloc array. Only codeclib should need this. */
123 void* (*get_codec_memory)(size_t *size); 126 void* (*get_codec_memory)(size_t *size);
@@ -160,6 +163,28 @@ struct codec_api {
160 void (*PREFIX(sleep))(int ticks); 163 void (*PREFIX(sleep))(int ticks);
161 void (*yield)(void); 164 void (*yield)(void);
162 165
166#if NUM_CORES > 1
167 struct thread_entry *
168 (*create_thread)(void (*function)(void), void* stack,
169 size_t stack_size, unsigned flags, const char *name
170 IF_PRIO(, int priority)
171 IF_COP(, unsigned int core));
172
173 void (*thread_thaw)(struct thread_entry *thread);
174 void (*thread_wait)(struct thread_entry *thread);
175 void (*semaphore_init)(struct semaphore *s, int max, int start);
176 void (*semaphore_wait)(struct semaphore *s);
177 void (*semaphore_release)(struct semaphore *s);
178 void (*event_init)(struct event *e, unsigned int flags);
179 void (*event_wait)(struct event *e, unsigned int for_state);
180 void (*event_set_state)(struct event *e, unsigned int state);
181#endif /* NUM_CORES */
182
183#ifdef CACHE_FUNCTIONS_AS_CALL
184 void (*flush_icache)(void);
185 void (*invalidate_icache)(void);
186#endif
187
163 /* strings and memory */ 188 /* strings and memory */
164 char* (*strcpy)(char *dst, const char *src); 189 char* (*strcpy)(char *dst, const char *src);
165 char* (*strncpy)(char *dst, const char *src, size_t length); 190 char* (*strncpy)(char *dst, const char *src, size_t length);
@@ -218,29 +243,6 @@ struct codec_api {
218 /* new stuff at the end, sort into place next time 243 /* new stuff at the end, sort into place next time
219 the API gets incompatible */ 244 the API gets incompatible */
220 245
221#ifdef CACHE_FUNCTIONS_AS_CALL
222 void (*flush_icache)(void);
223 void (*invalidate_icache)(void);
224#endif
225
226 struct dsp_config *dsp;
227
228#if NUM_CORES > 1
229 struct thread_entry *
230 (*create_thread)(void (*function)(void), void* stack,
231 int stack_size, unsigned flags, const char *name
232 IF_PRIO(, int priority)
233 IF_COP(, unsigned int core));
234
235 void (*thread_thaw)(struct thread_entry *thread);
236 void (*thread_wait)(struct thread_entry *thread);
237 void (*semaphore_init)(struct semaphore *s, int max, int start);
238 void (*semaphore_wait)(struct semaphore *s);
239 void (*semaphore_release)(struct semaphore *s);
240 void (*event_init)(struct event *e, unsigned int flags);
241 void (*event_wait)(struct event *e, unsigned int for_state);
242 void (*event_set_state)(struct event *e, unsigned int state);
243#endif /* NUM_CORES */
244}; 246};
245 247
246/* codec header */ 248/* codec header */
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index d865f12e65..fc509ce236 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -127,11 +127,6 @@ static char thread_status_char(unsigned status)
127 [STATE_KILLED] = 'K', 127 [STATE_KILLED] = 'K',
128 }; 128 };
129 129
130#if NUM_CORES > 1
131 if (status == STATE_BUSY) /* Not a state index */
132 return '.';
133#endif
134
135 if (status > THREAD_NUM_STATES) 130 if (status > THREAD_NUM_STATES)
136 status = THREAD_NUM_STATES; 131 status = THREAD_NUM_STATES;
137 132
@@ -166,15 +161,15 @@ static char* threads_getname(int selected_item, void * data, char *buffer)
166 thread_get_name(name, 32, thread); 161 thread_get_name(name, 32, thread);
167 162
168 snprintf(buffer, MAX_PATH, 163 snprintf(buffer, MAX_PATH,
169 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d ") "%2d%% %s", 164 "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d %d ") "%2d%% %s",
170 selected_item, 165 selected_item,
171 IF_COP(thread->core,) 166 IF_COP(thread->core,)
172#ifdef HAVE_SCHEDULER_BOOSTCTRL 167#ifdef HAVE_SCHEDULER_BOOSTCTRL
173 (thread->boosted) ? '+' : 168 (thread->cpu_boost) ? '+' :
174#endif 169#endif
175 ((thread->state == STATE_RUNNING) ? '*' : ' '), 170 ((thread->state == STATE_RUNNING) ? '*' : ' '),
176 thread_status_char(thread->state), 171 thread_status_char(thread->state),
177 IF_PRIO(thread->priority,) 172 IF_PRIO(thread->base_priority, thread->priority, )
178 thread_stack_usage(thread), name); 173 thread_stack_usage(thread), name);
179 174
180 return buffer; 175 return buffer;
diff --git a/apps/main.c b/apps/main.c
index 5dd92e5e02..a3a2241f44 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -270,7 +270,7 @@ static void init_tagcache(void)
270 270
271static void init(void) 271static void init(void)
272{ 272{
273 init_threads(); 273 kernel_init();
274 buffer_init(); 274 buffer_init();
275 set_irq_level(0); 275 set_irq_level(0);
276 lcd_init(); 276 lcd_init();
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index 8153118715..8f16c90523 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -116,7 +116,7 @@ static bool low_latency_mode = false;
116static bool pcmbuf_flush; 116static bool pcmbuf_flush;
117 117
118#ifdef HAVE_PRIORITY_SCHEDULING 118#ifdef HAVE_PRIORITY_SCHEDULING
119static int codec_thread_priority = 0; 119static int codec_thread_priority = PRIORITY_PLAYBACK;
120#endif 120#endif
121 121
122extern struct thread_entry *codec_thread_p; 122extern struct thread_entry *codec_thread_p;
@@ -256,18 +256,21 @@ static void boost_codec_thread(bool boost)
256 * will starve if the codec thread's priority is boosted. */ 256 * will starve if the codec thread's priority is boosted. */
257 if (boost) 257 if (boost)
258 { 258 {
259 if (codec_thread_priority == 0) 259 int priority = (PRIORITY_PLAYBACK - PRIORITY_PLAYBACK_MAX)*pcmbuf_unplayed_bytes
260 / (2*NATIVE_FREQUENCY) + PRIORITY_PLAYBACK_MAX;
261
262 if (priority != codec_thread_priority)
260 { 263 {
261 codec_thread_priority = thread_set_priority( 264 codec_thread_priority = priority;
262 codec_thread_p, PRIORITY_REALTIME); 265 thread_set_priority(codec_thread_p, priority);
263 voice_thread_set_priority(PRIORITY_REALTIME); 266 voice_thread_set_priority(priority);
264 } 267 }
265 } 268 }
266 else if (codec_thread_priority != 0) 269 else if (codec_thread_priority != PRIORITY_PLAYBACK)
267 { 270 {
268 thread_set_priority(codec_thread_p, codec_thread_priority); 271 thread_set_priority(codec_thread_p, PRIORITY_PLAYBACK);
269 voice_thread_set_priority(codec_thread_priority); 272 voice_thread_set_priority(PRIORITY_PLAYBACK);
270 codec_thread_priority = 0; 273 codec_thread_priority = PRIORITY_PLAYBACK;
271 } 274 }
272} 275}
273#endif /* HAVE_PRIORITY_SCHEDULING */ 276#endif /* HAVE_PRIORITY_SCHEDULING */
@@ -818,7 +821,7 @@ static bool prepare_insert(size_t length)
818 if (low_latency_mode) 821 if (low_latency_mode)
819 { 822 {
820 /* 1/4s latency. */ 823 /* 1/4s latency. */
821 if (pcmbuf_unplayed_bytes > NATIVE_FREQUENCY * 4 / 4 824 if (pcmbuf_unplayed_bytes > NATIVE_FREQUENCY * 4 / 2
822 && pcm_is_playing()) 825 && pcm_is_playing())
823 return false; 826 return false;
824 } 827 }
diff --git a/apps/playback.c b/apps/playback.c
index 7eecd23e35..9005b3485c 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -2549,9 +2549,7 @@ void audio_init(void)
2549 to send messages. Thread creation will be delayed however so nothing 2549 to send messages. Thread creation will be delayed however so nothing
2550 starts running until ready if something yields such as talk_init. */ 2550 starts running until ready if something yields such as talk_init. */
2551 queue_init(&audio_queue, true); 2551 queue_init(&audio_queue, true);
2552 queue_enable_queue_send(&audio_queue, &audio_queue_sender_list);
2553 queue_init(&codec_queue, false); 2552 queue_init(&codec_queue, false);
2554 queue_enable_queue_send(&codec_queue, &codec_queue_sender_list);
2555 queue_init(&pcmbuf_queue, false); 2553 queue_init(&pcmbuf_queue, false);
2556 2554
2557 pcm_init(); 2555 pcm_init();
@@ -2587,11 +2585,17 @@ void audio_init(void)
2587 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK) 2585 codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)
2588 IF_COP(, CPU)); 2586 IF_COP(, CPU));
2589 2587
2588 queue_enable_queue_send(&codec_queue, &codec_queue_sender_list,
2589 codec_thread_p);
2590
2590 audio_thread_p = create_thread(audio_thread, audio_stack, 2591 audio_thread_p = create_thread(audio_thread, audio_stack,
2591 sizeof(audio_stack), CREATE_THREAD_FROZEN, 2592 sizeof(audio_stack), CREATE_THREAD_FROZEN,
2592 audio_thread_name IF_PRIO(, PRIORITY_SYSTEM) 2593 audio_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE)
2593 IF_COP(, CPU)); 2594 IF_COP(, CPU));
2594 2595
2596 queue_enable_queue_send(&audio_queue, &audio_queue_sender_list,
2597 audio_thread_p);
2598
2595#ifdef PLAYBACK_VOICE 2599#ifdef PLAYBACK_VOICE
2596 voice_thread_init(); 2600 voice_thread_init();
2597#endif 2601#endif
diff --git a/apps/plugin.c b/apps/plugin.c
index 57f836c5d2..db9bd2574a 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -253,15 +253,12 @@ static const struct plugin_api rockbox_api = {
253 /* kernel/ system */ 253 /* kernel/ system */
254 PREFIX(sleep), 254 PREFIX(sleep),
255 yield, 255 yield,
256#ifdef HAVE_PRIORITY_SCHEDULING
257 priority_yield,
258#endif
259 &current_tick, 256 &current_tick,
260 default_event_handler, 257 default_event_handler,
261 default_event_handler_ex, 258 default_event_handler_ex,
262 threads, 259 threads,
263 create_thread, 260 create_thread,
264 remove_thread, 261 thread_exit,
265 thread_wait, 262 thread_wait,
266#if (CONFIG_CODEC == SWCODEC) 263#if (CONFIG_CODEC == SWCODEC)
267 mutex_init, 264 mutex_init,
diff --git a/apps/plugin.h b/apps/plugin.h
index cd426564ba..57624739c7 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -119,12 +119,12 @@
119#define PLUGIN_MAGIC 0x526F634B /* RocK */ 119#define PLUGIN_MAGIC 0x526F634B /* RocK */
120 120
121/* increase this every time the api struct changes */ 121/* increase this every time the api struct changes */
122#define PLUGIN_API_VERSION 100 122#define PLUGIN_API_VERSION 101
123 123
124/* update this to latest version if a change to the api struct breaks 124/* update this to latest version if a change to the api struct breaks
125 backwards compatibility (and please take the opportunity to sort in any 125 backwards compatibility (and please take the opportunity to sort in any
126 new function which are "waiting" at the end of the function table) */ 126 new function which are "waiting" at the end of the function table) */
127#define PLUGIN_MIN_API_VERSION 100 127#define PLUGIN_MIN_API_VERSION 101
128 128
129/* plugin return codes */ 129/* plugin return codes */
130enum plugin_status { 130enum plugin_status {
@@ -351,19 +351,16 @@ struct plugin_api {
351 /* kernel/ system */ 351 /* kernel/ system */
352 void (*PREFIX(sleep))(int ticks); 352 void (*PREFIX(sleep))(int ticks);
353 void (*yield)(void); 353 void (*yield)(void);
354#ifdef HAVE_PRIORITY_SCHEDULING
355 void (*priority_yield)(void);
356#endif
357 volatile long* current_tick; 354 volatile long* current_tick;
358 long (*default_event_handler)(long event); 355 long (*default_event_handler)(long event);
359 long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); 356 long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter);
360 struct thread_entry* threads; 357 struct thread_entry* threads;
361 struct thread_entry* (*create_thread)(void (*function)(void), void* stack, 358 struct thread_entry* (*create_thread)(void (*function)(void), void* stack,
362 int stack_size, unsigned flags, 359 size_t stack_size, unsigned flags,
363 const char *name 360 const char *name
364 IF_PRIO(, int priority) 361 IF_PRIO(, int priority)
365 IF_COP(, unsigned int core)); 362 IF_COP(, unsigned int core));
366 void (*remove_thread)(struct thread_entry *thread); 363 void (*thread_exit)(void);
367 void (*thread_wait)(struct thread_entry *thread); 364 void (*thread_wait)(struct thread_entry *thread);
368#if CONFIG_CODEC == SWCODEC 365#if CONFIG_CODEC == SWCODEC
369 void (*mutex_init)(struct mutex *m); 366 void (*mutex_init)(struct mutex *m);
@@ -405,7 +402,8 @@ struct plugin_api {
405 int ticks); 402 int ticks);
406#if CONFIG_CODEC == SWCODEC 403#if CONFIG_CODEC == SWCODEC
407 void (*queue_enable_queue_send)(struct event_queue *q, 404 void (*queue_enable_queue_send)(struct event_queue *q,
408 struct queue_sender_list *send); 405 struct queue_sender_list *send,
406 struct thread_entry *owner);
409 bool (*queue_empty)(const struct event_queue *q); 407 bool (*queue_empty)(const struct event_queue *q);
410 void (*queue_wait)(struct event_queue *q, struct queue_event *ev); 408 void (*queue_wait)(struct event_queue *q, struct queue_event *ev);
411 intptr_t (*queue_send)(struct event_queue *q, long id, 409 intptr_t (*queue_send)(struct event_queue *q, long id,
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c
index 2bb766ad88..7d2f849a44 100644
--- a/apps/plugins/mpegplayer/audio_thread.c
+++ b/apps/plugins/mpegplayer/audio_thread.c
@@ -714,12 +714,14 @@ bool audio_thread_init(void)
714 /* Start the audio thread */ 714 /* Start the audio thread */
715 audio_str.hdr.q = &audio_str_queue; 715 audio_str.hdr.q = &audio_str_queue;
716 rb->queue_init(audio_str.hdr.q, false); 716 rb->queue_init(audio_str.hdr.q, false);
717 rb->queue_enable_queue_send(audio_str.hdr.q, &audio_str_queue_send);
718 717
719 /* One-up on the priority since the core DSP over-yields internally */ 718 /* One-up on the priority since the core DSP over-yields internally */
720 audio_str.thread = rb->create_thread( 719 audio_str.thread = rb->create_thread(
721 audio_thread, audio_stack, audio_stack_size, 0, 720 audio_thread, audio_stack, audio_stack_size, 0,
722 "mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK-1) IF_COP(, CPU)); 721 "mpgaudio" IF_PRIO(,PRIORITY_PLAYBACK-4) IF_COP(, CPU));
722
723 rb->queue_enable_queue_send(audio_str.hdr.q, &audio_str_queue_send,
724 audio_str.thread);
723 725
724 if (audio_str.thread == NULL) 726 if (audio_str.thread == NULL)
725 return false; 727 return false;
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c
index a408b90a67..289918fc63 100644
--- a/apps/plugins/mpegplayer/disk_buf.c
+++ b/apps/plugins/mpegplayer/disk_buf.c
@@ -837,7 +837,6 @@ bool disk_buf_init(void)
837 837
838 disk_buf.q = &disk_buf_queue; 838 disk_buf.q = &disk_buf_queue;
839 rb->queue_init(disk_buf.q, false); 839 rb->queue_init(disk_buf.q, false);
840 rb->queue_enable_queue_send(disk_buf.q, &disk_buf_queue_send);
841 840
842 disk_buf.state = TSTATE_EOS; 841 disk_buf.state = TSTATE_EOS;
843 disk_buf.status = STREAM_STOPPED; 842 disk_buf.status = STREAM_STOPPED;
@@ -886,6 +885,9 @@ bool disk_buf_init(void)
886 disk_buf_thread, disk_buf_stack, sizeof(disk_buf_stack), 0, 885 disk_buf_thread, disk_buf_stack, sizeof(disk_buf_stack), 0,
887 "mpgbuffer" IF_PRIO(, PRIORITY_BUFFERING) IF_COP(, CPU)); 886 "mpgbuffer" IF_PRIO(, PRIORITY_BUFFERING) IF_COP(, CPU));
888 887
888 rb->queue_enable_queue_send(disk_buf.q, &disk_buf_queue_send,
889 disk_buf.thread);
890
889 if (disk_buf.thread == NULL) 891 if (disk_buf.thread == NULL)
890 return false; 892 return false;
891 893
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c
index 9da664effe..b962c5b993 100644
--- a/apps/plugins/mpegplayer/stream_mgr.c
+++ b/apps/plugins/mpegplayer/stream_mgr.c
@@ -987,7 +987,6 @@ int stream_init(void)
987 987
988 stream_mgr.q = &stream_mgr_queue; 988 stream_mgr.q = &stream_mgr_queue;
989 rb->queue_init(stream_mgr.q, false); 989 rb->queue_init(stream_mgr.q, false);
990 rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send);
991 990
992 /* sets audiosize and returns buffer pointer */ 991 /* sets audiosize and returns buffer pointer */
993 mem = rb->plugin_get_audio_buffer(&memsize); 992 mem = rb->plugin_get_audio_buffer(&memsize);
@@ -1028,6 +1027,9 @@ int stream_init(void)
1028 stream_mgr_thread_stack, sizeof(stream_mgr_thread_stack), 1027 stream_mgr_thread_stack, sizeof(stream_mgr_thread_stack),
1029 0, "mpgstream_mgr" IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU)); 1028 0, "mpgstream_mgr" IF_PRIO(, PRIORITY_SYSTEM) IF_COP(, CPU));
1030 1029
1030 rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send,
1031 stream_mgr.thread);
1032
1031 if (stream_mgr.thread == NULL) 1033 if (stream_mgr.thread == NULL)
1032 { 1034 {
1033 rb->splash(HZ, "Could not create stream manager thread!"); 1035 rb->splash(HZ, "Could not create stream manager thread!");
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 6508d28d1d..d16eb771b0 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -955,7 +955,7 @@ static void video_thread(void)
955 else 955 else
956 { 956 {
957 /* Just a little left - spin and be accurate */ 957 /* Just a little left - spin and be accurate */
958 rb->priority_yield(); 958 rb->yield();
959 if (str_have_msg(&video_str)) 959 if (str_have_msg(&video_str))
960 goto message_wait; 960 goto message_wait;
961 } 961 }
@@ -998,13 +998,15 @@ bool video_thread_init(void)
998 998
999 video_str.hdr.q = &video_str_queue; 999 video_str.hdr.q = &video_str_queue;
1000 rb->queue_init(video_str.hdr.q, false); 1000 rb->queue_init(video_str.hdr.q, false);
1001 rb->queue_enable_queue_send(video_str.hdr.q, &video_str_queue_send);
1002 1001
1003 /* We put the video thread on another processor for multi-core targets. */ 1002 /* We put the video thread on another processor for multi-core targets. */
1004 video_str.thread = rb->create_thread( 1003 video_str.thread = rb->create_thread(
1005 video_thread, video_stack, VIDEO_STACKSIZE, 0, 1004 video_thread, video_stack, VIDEO_STACKSIZE, 0,
1006 "mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP)); 1005 "mpgvideo" IF_PRIO(,PRIORITY_PLAYBACK) IF_COP(, COP));
1007 1006
1007 rb->queue_enable_queue_send(video_str.hdr.q, &video_str_queue_send,
1008 video_str.thread);
1009
1008 if (video_str.thread == NULL) 1010 if (video_str.thread == NULL)
1009 return false; 1011 return false;
1010 1012
diff --git a/apps/voice_thread.c b/apps/voice_thread.c
index 7bf52d4d0d..6e70f43cc5 100644
--- a/apps/voice_thread.c
+++ b/apps/voice_thread.c
@@ -424,12 +424,14 @@ void voice_thread_init(void)
424{ 424{
425 logf("Starting voice thread"); 425 logf("Starting voice thread");
426 queue_init(&voice_queue, false); 426 queue_init(&voice_queue, false);
427 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list);
428 mutex_init(&voice_mutex); 427 mutex_init(&voice_mutex);
429 event_init(&voice_event, STATE_SIGNALED | EVENT_MANUAL); 428 event_init(&voice_event, STATE_SIGNALED | EVENT_MANUAL);
430 voice_thread_p = create_thread(voice_thread, voice_stack, 429 voice_thread_p = create_thread(voice_thread, voice_stack,
431 sizeof(voice_stack), CREATE_THREAD_FROZEN, 430 sizeof(voice_stack), CREATE_THREAD_FROZEN,
432 voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU)); 431 voice_thread_name IF_PRIO(, PRIORITY_PLAYBACK) IF_COP(, CPU));
432
433 queue_enable_queue_send(&voice_queue, &voice_queue_sender_list,
434 voice_thread_p);
433} /* voice_thread_init */ 435} /* voice_thread_init */
434 436
435/* Unfreeze the voice thread */ 437/* Unfreeze the voice thread */