summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/codecflac.c5
-rw-r--r--apps/plugins/codecmpa.c8
-rw-r--r--apps/plugins/codecvorbis.c1
3 files changed, 13 insertions, 1 deletions
diff --git a/apps/plugins/codecflac.c b/apps/plugins/codecflac.c
index d577006440..8d0653e364 100644
--- a/apps/plugins/codecflac.c
+++ b/apps/plugins/codecflac.c
@@ -57,6 +57,7 @@ FLAC__StreamDecoderWriteStatus flac_write_handler(const FLAC__SeekableStreamDeco
57 unsigned int c_samp, c_chan, d_samp; 57 unsigned int c_samp, c_chan, d_samp;
58 uint32_t data_size = frame->header.blocksize * frame->header.channels * 2; /* Assume 16-bit words */ 58 uint32_t data_size = frame->header.blocksize * frame->header.channels * 2; /* Assume 16-bit words */
59 uint32_t samples = frame->header.blocksize; 59 uint32_t samples = frame->header.blocksize;
60 int yieldcounter = 0;
60 61
61 62
62 if (samples*frame->header.channels > (FLAC_MAX_SUPPORTED_BLOCKSIZE*FLAC_MAX_SUPPORTED_CHANNELS)) { 63 if (samples*frame->header.channels > (FLAC_MAX_SUPPORTED_BLOCKSIZE*FLAC_MAX_SUPPORTED_CHANNELS)) {
@@ -70,6 +71,10 @@ FLAC__StreamDecoderWriteStatus flac_write_handler(const FLAC__SeekableStreamDeco
70 for(c_chan = 0; c_chan < frame->header.channels; c_chan++, d_samp++) { 71 for(c_chan = 0; c_chan < frame->header.channels; c_chan++, d_samp++) {
71 pcmbuf[d_samp*2] = (buf[c_chan][c_samp]&0xff00)>>8; 72 pcmbuf[d_samp*2] = (buf[c_chan][c_samp]&0xff00)>>8;
72 pcmbuf[(d_samp*2)+1] = buf[c_chan][c_samp]&0xff; 73 pcmbuf[(d_samp*2)+1] = buf[c_chan][c_samp]&0xff;
74 if (yieldcounter++ == 100) {
75 rb->yield();
76 yieldcounter = 0;
77 }
73 } 78 }
74 } 79 }
75 80
diff --git a/apps/plugins/codecmpa.c b/apps/plugins/codecmpa.c
index 88f6b8c624..bf6cf3f87d 100644
--- a/apps/plugins/codecmpa.c
+++ b/apps/plugins/codecmpa.c
@@ -198,6 +198,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parm)
198 int fd; 198 int fd;
199#endif 199#endif
200 int i; 200 int i;
201 int yieldcounter = 0;
201 202
202 /* Generic plugin inititialisation */ 203 /* Generic plugin inititialisation */
203 204
@@ -217,6 +218,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parm)
217 /* Create a decoder instance */ 218 /* Create a decoder instance */
218 219
219 ci->configure(CODEC_SET_FILEBUF_LIMIT, (int *)(1024*1024*2)); 220 ci->configure(CODEC_SET_FILEBUF_LIMIT, (int *)(1024*1024*2));
221 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*16));
220 222
221 next_track: 223 next_track:
222 memset(&Stream, 0, sizeof(struct mad_stream)); 224 memset(&Stream, 0, sizeof(struct mad_stream));
@@ -379,10 +381,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parm)
379 goto song_end; 381 goto song_end;
380 } 382 }
381 383
384 if (yieldcounter++ == 200) {
385 rb->yield();
386 yieldcounter = 0;
387 }
388
382 /* Flush the buffer if it is full. */ 389 /* Flush the buffer if it is full. */
383 if(OutputPtr==OutputBufferEnd) 390 if(OutputPtr==OutputBufferEnd)
384 { 391 {
385 rb->yield();
386#ifdef DEBUG_GAPLESS 392#ifdef DEBUG_GAPLESS
387 rb->write(fd, OutputBuffer, OUTPUT_BUFFER_SIZE); 393 rb->write(fd, OutputBuffer, OUTPUT_BUFFER_SIZE);
388#endif 394#endif
diff --git a/apps/plugins/codecvorbis.c b/apps/plugins/codecvorbis.c
index c1ccdfd3fa..6c512f7ce4 100644
--- a/apps/plugins/codecvorbis.c
+++ b/apps/plugins/codecvorbis.c
@@ -105,6 +105,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parm)
105 #endif 105 #endif
106 106
107 ci->configure(CODEC_SET_FILEBUF_LIMIT, (int *)(1024*1024*2)); 107 ci->configure(CODEC_SET_FILEBUF_LIMIT, (int *)(1024*1024*2));
108 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*32));
108 109
109 /* We need to flush reserver memory every track load. */ 110 /* We need to flush reserver memory every track load. */
110 next_track: 111 next_track: