summaryrefslogtreecommitdiff
path: root/apps/codecs/vorbis.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/vorbis.c')
-rw-r--r--apps/codecs/vorbis.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/codecs/vorbis.c b/apps/codecs/vorbis.c
index 74d582ebb3..f14aeead84 100644
--- a/apps/codecs/vorbis.c
+++ b/apps/codecs/vorbis.c
@@ -25,6 +25,11 @@
25 25
26CODEC_HEADER 26CODEC_HEADER
27 27
28#if defined(CPU_ARM) || defined(CPU_COLDFIRE)
29#include <setjmp.h>
30jmp_buf rb_jump_buf;
31#endif
32
28/* Some standard functions and variables needed by Tremor */ 33/* Some standard functions and variables needed by Tremor */
29 34
30static size_t read_handler(void *ptr, size_t size, size_t nmemb, void *datasource) 35static size_t read_handler(void *ptr, size_t size, size_t nmemb, void *datasource)
@@ -107,7 +112,7 @@ enum codec_status codec_main(void)
107 int error; 112 int error;
108 long n; 113 long n;
109 int current_section; 114 int current_section;
110 int previous_section = -1; 115 int previous_section;
111 int eof; 116 int eof;
112 ogg_int64_t vf_offsets[2]; 117 ogg_int64_t vf_offsets[2];
113 ogg_int64_t vf_dataoffsets; 118 ogg_int64_t vf_dataoffsets;
@@ -119,6 +124,15 @@ enum codec_status codec_main(void)
119 * they should be set differently based on quality setting 124 * they should be set differently based on quality setting
120 */ 125 */
121 126
127#if defined(CPU_ARM) || defined(CPU_COLDFIRE)
128 if (setjmp(rb_jump_buf) != 0)
129 {
130 /* malloc failed; skip to next track */
131 error = CODEC_ERROR;
132 goto done;
133 }
134#endif
135
122/* We need to flush reserver memory every track load. */ 136/* We need to flush reserver memory every track load. */
123next_track: 137next_track:
124 if (codec_init()) { 138 if (codec_init()) {
@@ -181,6 +195,7 @@ next_track:
181 ci->set_offset(ov_raw_tell(&vf)); 195 ci->set_offset(ov_raw_tell(&vf));
182 } 196 }
183 197
198 previous_section = -1;
184 eof = 0; 199 eof = 0;
185 while (!eof) { 200 while (!eof) {
186 ci->yield(); 201 ci->yield();
@@ -227,7 +242,6 @@ done:
227 vf.serialnos = NULL; 242 vf.serialnos = NULL;
228 vf.pcmlengths = NULL; 243 vf.pcmlengths = NULL;
229 ov_clear(&vf); 244 ov_clear(&vf);
230 previous_section = -1;
231 goto next_track; 245 goto next_track;
232 } 246 }
233 247