summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-03-02 03:47:42 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-03-02 03:47:42 +0000
commitb3bfc09852007fed60bf71451a6c71df8c28b3ed (patch)
tree1675ed55887fbe699ca16405ab95da4e6bcf3dde /apps
parent6170ded83d342b52f0bb1237a705f3f98e99695a (diff)
downloadrockbox-b3bfc09852007fed60bf71451a6c71df8c28b3ed.tar.gz
rockbox-b3bfc09852007fed60bf71451a6c71df8c28b3ed.zip
r29348 changes can cause certain codecs to jump to code on early track change that assumes initializations have been done. Make sure that track change cleanups are only called if the state is sane to do so. Stops my vorbis data abort issue. Correctness for speex is a guess based on the library calls' source. It appears only speex/vorbis should have been bothered by said revision.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29489 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/speex.c12
-rw-r--r--apps/codecs/vorbis.c4
2 files changed, 12 insertions, 4 deletions
diff --git a/apps/codecs/speex.c b/apps/codecs/speex.c
index e38a04495c..7a1efa9753 100644
--- a/apps/codecs/speex.c
+++ b/apps/codecs/speex.c
@@ -393,6 +393,9 @@ enum codec_status codec_main(void)
void *st = NULL;
int j = 0;
+ memset(&bits, 0, sizeof(bits));
+ memset(&oy, 0, sizeof(oy));
+
/* Ogg handling still uses mallocs, so reset the malloc buffer per track */
next_track:
error = CODEC_OK;
@@ -401,16 +404,16 @@ next_track:
error = CODEC_ERROR;
goto exit;
}
+
stereo = speex_stereo_state_init();
+ spx_ogg_sync_init(&oy);
+ spx_ogg_alloc_buffer(&oy,2*CHUNKSIZE);
if (codec_wait_taginfo() != 0)
goto done;
strtoffset = ci->id3->offset;
- spx_ogg_sync_init(&oy);
- spx_ogg_alloc_buffer(&oy,2*CHUNKSIZE);
-
samplerate = ci->id3->frequency;
codec_set_replaygain(ci->id3);
@@ -558,7 +561,8 @@ done:
/* Clean things up for the next track */
- speex_decoder_destroy(st);
+ if (st)
+ speex_decoder_destroy(st);
if (stream_init == 1)
spx_ogg_stream_reset(&os);
diff --git a/apps/codecs/vorbis.c b/apps/codecs/vorbis.c
index 17cc4a03f9..0a36a37c8b 100644
--- a/apps/codecs/vorbis.c
+++ b/apps/codecs/vorbis.c
@@ -110,6 +110,7 @@ enum codec_status codec_main(void)
OggVorbis_File vf;
ogg_int32_t **pcm;
+ bool initialized = false; /* First init done? */
int error;
long n;
int current_section;
@@ -185,6 +186,7 @@ next_track:
vf.end = ci->id3->filesize;
vf.ready_state = OPENED;
vf.links = 1;
+ initialized = true;
} else {
DEBUGF("Vorbis: ov_open failed: %d\n", error);
error = CODEC_ERROR;
@@ -248,6 +250,8 @@ done:
ogg_malloc_destroy();
if (ci->request_next_track()) {
+ if (!initialized)
+ goto next_track;
/* Clean things up for the next track */
vf.dataoffsets = NULL;
vf.offsets = NULL;