diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2007-10-19 09:11:23 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2007-10-19 09:11:23 +0000 |
| commit | 9ec00d7f25f2f6ec0fe43eae0b1749dafde0b32c (patch) | |
| tree | 1f0c73403fb37a6e554182f219fc52649fd6d64e /apps/plugins/test_codec.c | |
| parent | df1f0d642946d125b03b83209f4c5a6fd4b156b3 (diff) | |
| download | rockbox-9ec00d7f25f2f6ec0fe43eae0b1749dafde0b32c.zip rockbox-9ec00d7f25f2f6ec0fe43eae0b1749dafde0b32c.tar.gz rockbox-9ec00d7f25f2f6ec0fe43eae0b1749dafde0b32c.tar.bz2 rockbox-9ec00d7f25f2f6ec0fe43eae0b1749dafde0b32c.tar.xz | |
Add the thread state check into test_codec as used in mpegplayer which makes it should make it less prone to trash the codec thread after use.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15203 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/test_codec.c')
| -rw-r--r-- | apps/plugins/test_codec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index e2f599c..9859e0c 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -655,6 +655,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) return PLUGIN_ERROR; } + codec_mallocbuf = rb->plugin_get_audio_buffer(&audiosize); + #ifdef SIMULATOR /* The simulator thread implementation doesn't have stack buffers */ (void)i; @@ -666,6 +668,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { if (rb->strcmp(rb->threads[i].name,"codec")==0) { + /* Wait to ensure the codec thread has blocked */ + while (rb->threads[i].state!=STATE_BLOCKED) + rb->yield(); + codec_stack = rb->threads[i].stack; codec_stack_size = rb->threads[i].stack_size; break; @@ -679,7 +685,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) } #endif - codec_mallocbuf = rb->plugin_get_audio_buffer(&audiosize); codec_stack_copy = codec_mallocbuf + 512*1024; audiobuf = codec_stack_copy + codec_stack_size; audiosize -= 512*1024 + codec_stack_size; |