diff options
-rwxr-xr-x[-rw-r--r--] | apps/codecs/wma.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/apps/codecs/wma.c b/apps/codecs/wma.c index 361fee6175..f9501ffad3 100644..100755 --- a/apps/codecs/wma.c +++ b/apps/codecs/wma.c | |||
@@ -54,14 +54,15 @@ enum codec_status codec_run(void) | |||
54 | int errcount = 0; | 54 | int errcount = 0; |
55 | intptr_t param; | 55 | intptr_t param; |
56 | 56 | ||
57 | /* Proper reset of the decoder context. */ | ||
58 | memset(&wmadec, 0, sizeof(wmadec)); | ||
59 | |||
60 | /* Remember the resume position - when the codec is opened, the | 57 | /* Remember the resume position - when the codec is opened, the |
61 | playback engine will reset it. */ | 58 | playback engine will reset it. */ |
62 | resume_offset = ci->id3->offset; | 59 | resume_offset = ci->id3->offset; |
63 | 60 | ||
64 | restart_track: | 61 | restart_track: |
62 | |||
63 | /* Proper reset of the decoder context. */ | ||
64 | memset(&wmadec, 0, sizeof(wmadec)); | ||
65 | |||
65 | if (codec_init()) { | 66 | if (codec_init()) { |
66 | LOGF("WMA: Error initialising codec\n"); | 67 | LOGF("WMA: Error initialising codec\n"); |
67 | return CODEC_ERROR; | 68 | return CODEC_ERROR; |
@@ -111,6 +112,15 @@ restart_track: | |||
111 | /* Deal with any pending seek requests */ | 112 | /* Deal with any pending seek requests */ |
112 | if (action == CODEC_ACTION_SEEK_TIME) { | 113 | if (action == CODEC_ACTION_SEEK_TIME) { |
113 | 114 | ||
115 | /*flush the wma decoder state*/ | ||
116 | wmadec.last_superframe_len = 0; | ||
117 | wmadec.last_bitoffset = 0; | ||
118 | |||
119 | /*zero the frame out buffer so we don't overlap with a | ||
120 | stale samples*/ | ||
121 | memset((*(wmadec.frame_out)), 0, | ||
122 | sizeof(fixed32) * MAX_CHANNELS * BLOCK_MAX_SIZE * 2); | ||
123 | |||
114 | if (param == 0) { | 124 | if (param == 0) { |
115 | ci->set_elapsed(0); | 125 | ci->set_elapsed(0); |
116 | ci->seek_complete(); | 126 | ci->seek_complete(); |
@@ -125,10 +135,6 @@ restart_track: | |||
125 | } | 135 | } |
126 | /*DEBUGF("Seek returned %d\n", (int)elapsedtime);*/ | 136 | /*DEBUGF("Seek returned %d\n", (int)elapsedtime);*/ |
127 | 137 | ||
128 | /*flush the wma decoder state*/ | ||
129 | wmadec.last_superframe_len = 0; | ||
130 | wmadec.last_bitoffset = 0; | ||
131 | |||
132 | ci->set_elapsed(elapsedtime); | 138 | ci->set_elapsed(elapsedtime); |
133 | ci->seek_complete(); | 139 | ci->seek_complete(); |
134 | } | 140 | } |