summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-11-30 05:16:56 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-11-30 05:16:56 +0000
commit5323fe996b6a62be2201de2b2a5f6917a6040cb1 (patch)
tree9ae9d6473718ecb686e9eaa5bf1804e276f2a0c2
parentb0dd9eb5bcdd0c320444474fbf3a0f09dc71684d (diff)
downloadrockbox-5323fe996b6a62be2201de2b2a5f6917a6040cb1.tar.gz
rockbox-5323fe996b6a62be2201de2b2a5f6917a6040cb1.zip
Move encoder CPU boost control to the core. Allow CPU to sleep a bit when PCM buffer is empty and save some power. Codec API becomes incompatible so full updates! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15854 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs.c10
-rw-r--r--apps/codecs.h16
-rw-r--r--apps/codecs/aiff_enc.c31
-rw-r--r--apps/codecs/mp3_enc.c31
-rw-r--r--apps/codecs/wav_enc.c31
-rw-r--r--apps/codecs/wavpack_enc.c31
-rw-r--r--firmware/export/enc_base.h2
-rw-r--r--firmware/pcm_record.c33
8 files changed, 20 insertions, 165 deletions
diff --git a/apps/codecs.c b/apps/codecs.c
index 9969b6f597..dfae463865 100644
--- a/apps/codecs.c
+++ b/apps/codecs.c
@@ -131,7 +131,6 @@ struct codec_api ci = {
131 enc_set_parameters, 131 enc_set_parameters,
132 enc_get_chunk, 132 enc_get_chunk,
133 enc_finish_chunk, 133 enc_finish_chunk,
134 enc_pcm_buf_near_empty,
135 enc_get_pcm_data, 134 enc_get_pcm_data,
136 enc_unget_pcm_data, 135 enc_unget_pcm_data,
137 136
@@ -141,15 +140,6 @@ struct codec_api ci = {
141 (read_func)read, 140 (read_func)read,
142 PREFIX(lseek), 141 PREFIX(lseek),
143 (write_func)write, 142 (write_func)write,
144
145#ifdef HAVE_ADJUSTABLE_CPU_FREQ
146#ifdef CPU_BOOST_LOGGING
147 cpu_boost_,
148#else
149 cpu_boost,
150#endif
151#endif
152
153 round_value_to_list32, 143 round_value_to_list32,
154 144
155#endif 145#endif
diff --git a/apps/codecs.h b/apps/codecs.h
index 29ed2d351b..ad6b831b61 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -80,12 +80,12 @@
80#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ 80#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
81 81
82/* increase this every time the api struct changes */ 82/* increase this every time the api struct changes */
83#define CODEC_API_VERSION 21 83#define CODEC_API_VERSION 22
84 84
85/* update this to latest version if a change to the api struct breaks 85/* update this to latest version if a change to the api struct breaks
86 backwards compatibility (and please take the opportunity to sort in any 86 backwards compatibility (and please take the opportunity to sort in any
87 new function which are "waiting" at the end of the function table) */ 87 new function which are "waiting" at the end of the function table) */
88#define CODEC_MIN_API_VERSION 18 88#define CODEC_MIN_API_VERSION 22
89 89
90/* codec return codes */ 90/* codec return codes */
91enum codec_status { 91enum codec_status {
@@ -200,7 +200,6 @@ struct codec_api {
200 void (*enc_set_parameters)(struct enc_parameters *params); 200 void (*enc_set_parameters)(struct enc_parameters *params);
201 struct enc_chunk_hdr * (*enc_get_chunk)(void); 201 struct enc_chunk_hdr * (*enc_get_chunk)(void);
202 void (*enc_finish_chunk)(void); 202 void (*enc_finish_chunk)(void);
203 int (*enc_pcm_buf_near_empty)(void);
204 unsigned char * (*enc_get_pcm_data)(size_t size); 203 unsigned char * (*enc_get_pcm_data)(size_t size);
205 size_t (*enc_unget_pcm_data)(size_t size); 204 size_t (*enc_unget_pcm_data)(size_t size);
206 205
@@ -210,21 +209,10 @@ struct codec_api {
210 ssize_t (*read)(int fd, void* buf, size_t count); 209 ssize_t (*read)(int fd, void* buf, size_t count);
211 off_t (*PREFIX(lseek))(int fd, off_t offset, int whence); 210 off_t (*PREFIX(lseek))(int fd, off_t offset, int whence);
212 ssize_t (*write)(int fd, const void* buf, size_t count); 211 ssize_t (*write)(int fd, const void* buf, size_t count);
213
214 /* Encoder codecs adjust CPU boost themselves */
215#ifdef HAVE_ADJUSTABLE_CPU_FREQ
216#ifdef CPU_BOOST_LOGGING
217 void (*cpu_boost_)(bool on_off,char*location,int line);
218#else
219 void (*cpu_boost)(bool on_off);
220#endif
221#endif
222
223 int (*round_value_to_list32)(unsigned long value, 212 int (*round_value_to_list32)(unsigned long value,
224 const unsigned long list[], 213 const unsigned long list[],
225 int count, 214 int count,
226 bool signd); 215 bool signd);
227
228#endif 216#endif
229 217
230 /* new stuff at the end, sort into place next time 218 /* new stuff at the end, sort into place next time
diff --git a/apps/codecs/aiff_enc.c b/apps/codecs/aiff_enc.c
index 51c4344702..749c3a13a1 100644
--- a/apps/codecs/aiff_enc.c
+++ b/apps/codecs/aiff_enc.c
@@ -304,9 +304,6 @@ static bool init_encoder(void)
304 ci->enc_set_parameters == NULL || 304 ci->enc_set_parameters == NULL ||
305 ci->enc_get_chunk == NULL || 305 ci->enc_get_chunk == NULL ||
306 ci->enc_finish_chunk == NULL || 306 ci->enc_finish_chunk == NULL ||
307#ifdef HAVE_ADJUSTABLE_CPU_FREQ
308 ci->enc_pcm_buf_near_empty == NULL ||
309#endif
310 ci->enc_get_pcm_data == NULL ) 307 ci->enc_get_pcm_data == NULL )
311 return false; 308 return false;
312 309
@@ -334,10 +331,6 @@ static bool init_encoder(void)
334/* main codec entry point */ 331/* main codec entry point */
335enum codec_status codec_main(void) 332enum codec_status codec_main(void)
336{ 333{
337#ifdef HAVE_ADJUSTABLE_CPU_FREQ
338 bool cpu_boosted;
339#endif
340
341 if (!init_encoder()) 334 if (!init_encoder())
342 { 335 {
343 ci->enc_codec_loaded = -1; 336 ci->enc_codec_loaded = -1;
@@ -347,11 +340,6 @@ enum codec_status codec_main(void)
347 /* main application waits for this flag during encoder loading */ 340 /* main application waits for this flag during encoder loading */
348 ci->enc_codec_loaded = 1; 341 ci->enc_codec_loaded = 1;
349 342
350#ifdef HAVE_ADJUSTABLE_CPU_FREQ
351 ci->cpu_boost(true);
352 cpu_boosted = true;
353#endif
354
355 /* main encoding loop */ 343 /* main encoding loop */
356 while(!ci->stop_encoder) 344 while(!ci->stop_encoder)
357 { 345 {
@@ -364,13 +352,6 @@ enum codec_status codec_main(void)
364 if (ci->stop_encoder) 352 if (ci->stop_encoder)
365 break; 353 break;
366 354
367#ifdef HAVE_ADJUSTABLE_CPU_FREQ
368 if (!cpu_boosted && ci->enc_pcm_buf_near_empty() == 0)
369 {
370 ci->cpu_boost(true);
371 cpu_boosted = true;
372 }
373#endif
374 chunk = ci->enc_get_chunk(); 355 chunk = ci->enc_get_chunk();
375 chunk->enc_size = enc_size; 356 chunk->enc_size = enc_size;
376 chunk->num_pcm = PCM_SAMP_PER_CHUNK; 357 chunk->num_pcm = PCM_SAMP_PER_CHUNK;
@@ -382,21 +363,9 @@ enum codec_status codec_main(void)
382 ci->yield(); 363 ci->yield();
383 } 364 }
384 365
385#ifdef HAVE_ADJUSTABLE_CPU_FREQ
386 if (cpu_boosted && ci->enc_pcm_buf_near_empty() != 0)
387 {
388 ci->cpu_boost(false);
389 cpu_boosted = false;
390 }
391#endif
392 ci->yield(); 366 ci->yield();
393 } 367 }
394 368
395#ifdef HAVE_ADJUSTABLE_CPU_FREQ
396 if (cpu_boosted) /* set initial boost state */
397 ci->cpu_boost(false);
398#endif
399
400 /* reset parameters to initial state */ 369 /* reset parameters to initial state */
401 ci->enc_set_parameters(NULL); 370 ci->enc_set_parameters(NULL);
402 371
diff --git a/apps/codecs/mp3_enc.c b/apps/codecs/mp3_enc.c
index 1ec41ad45e..2dc9bcbb3d 100644
--- a/apps/codecs/mp3_enc.c
+++ b/apps/codecs/mp3_enc.c
@@ -2423,9 +2423,6 @@ static bool enc_init(void)
2423 ci->enc_set_parameters == NULL || 2423 ci->enc_set_parameters == NULL ||
2424 ci->enc_get_chunk == NULL || 2424 ci->enc_get_chunk == NULL ||
2425 ci->enc_finish_chunk == NULL || 2425 ci->enc_finish_chunk == NULL ||
2426#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2427 ci->enc_pcm_buf_near_empty == NULL ||
2428#endif
2429 ci->enc_get_pcm_data == NULL || 2426 ci->enc_get_pcm_data == NULL ||
2430 ci->enc_unget_pcm_data == NULL ) 2427 ci->enc_unget_pcm_data == NULL )
2431 return false; 2428 return false;
@@ -2461,10 +2458,6 @@ static bool enc_init(void)
2461 2458
2462enum codec_status codec_main(void) 2459enum codec_status codec_main(void)
2463{ 2460{
2464#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2465 bool cpu_boosted;
2466#endif
2467
2468 /* Generic codec initialisation */ 2461 /* Generic codec initialisation */
2469 if (!enc_init()) 2462 if (!enc_init())
2470 { 2463 {
@@ -2475,11 +2468,6 @@ enum codec_status codec_main(void)
2475 /* main application waits for this flag during encoder loading */ 2468 /* main application waits for this flag during encoder loading */
2476 ci->enc_codec_loaded = 1; 2469 ci->enc_codec_loaded = 1;
2477 2470
2478#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2479 ci->cpu_boost(true);
2480 cpu_boosted = true;
2481#endif
2482
2483 /* main encoding loop */ 2471 /* main encoding loop */
2484 while (!ci->stop_encoder) 2472 while (!ci->stop_encoder)
2485 { 2473 {
@@ -2492,13 +2480,6 @@ enum codec_status codec_main(void)
2492 if (ci->stop_encoder) 2480 if (ci->stop_encoder)
2493 break; 2481 break;
2494 2482
2495#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2496 if (!cpu_boosted && ci->enc_pcm_buf_near_empty() == 0)
2497 {
2498 ci->cpu_boost(true);
2499 cpu_boosted = true;
2500 }
2501#endif
2502 chunk = ci->enc_get_chunk(); 2483 chunk = ci->enc_get_chunk();
2503 chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk); 2484 chunk->enc_data = ENC_CHUNK_SKIP_HDR(chunk->enc_data, chunk);
2504 2485
@@ -2515,21 +2496,9 @@ enum codec_status codec_main(void)
2515 ci->yield(); 2496 ci->yield();
2516 } 2497 }
2517 2498
2518#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2519 if (cpu_boosted && ci->enc_pcm_buf_near_empty())
2520 {
2521 ci->cpu_boost(false);
2522 cpu_boosted = false;
2523 }
2524#endif
2525 ci->yield(); 2499 ci->yield();
2526 } 2500 }
2527 2501
2528#ifdef HAVE_ADJUSTABLE_CPU_FREQ
2529 if (cpu_boosted) /* set initial boost state */
2530 ci->cpu_boost(false);
2531#endif
2532
2533 /* reset parameters to initial state */ 2502 /* reset parameters to initial state */
2534 ci->enc_set_parameters(NULL); 2503 ci->enc_set_parameters(NULL);
2535 2504
diff --git a/apps/codecs/wav_enc.c b/apps/codecs/wav_enc.c
index eb43f8b240..25d2838e7d 100644
--- a/apps/codecs/wav_enc.c
+++ b/apps/codecs/wav_enc.c
@@ -291,9 +291,6 @@ static bool init_encoder(void)
291 ci->enc_set_parameters == NULL || 291 ci->enc_set_parameters == NULL ||
292 ci->enc_get_chunk == NULL || 292 ci->enc_get_chunk == NULL ||
293 ci->enc_finish_chunk == NULL || 293 ci->enc_finish_chunk == NULL ||
294#ifdef HAVE_ADJUSTABLE_CPU_FREQ
295 ci->enc_pcm_buf_near_empty == NULL ||
296#endif
297 ci->enc_get_pcm_data == NULL ) 294 ci->enc_get_pcm_data == NULL )
298 return false; 295 return false;
299 296
@@ -321,10 +318,6 @@ static bool init_encoder(void)
321/* main codec entry point */ 318/* main codec entry point */
322enum codec_status codec_main(void) 319enum codec_status codec_main(void)
323{ 320{
324#ifdef HAVE_ADJUSTABLE_CPU_FREQ
325 bool cpu_boosted;
326#endif
327
328 if (!init_encoder()) 321 if (!init_encoder())
329 { 322 {
330 ci->enc_codec_loaded = -1; 323 ci->enc_codec_loaded = -1;
@@ -334,11 +327,6 @@ enum codec_status codec_main(void)
334 /* main application waits for this flag during encoder loading */ 327 /* main application waits for this flag during encoder loading */
335 ci->enc_codec_loaded = 1; 328 ci->enc_codec_loaded = 1;
336 329
337#ifdef HAVE_ADJUSTABLE_CPU_FREQ
338 ci->cpu_boost(true);
339 cpu_boosted = true;
340#endif
341
342 /* main encoding loop */ 330 /* main encoding loop */
343 while(!ci->stop_encoder) 331 while(!ci->stop_encoder)
344 { 332 {
@@ -351,13 +339,6 @@ enum codec_status codec_main(void)
351 if (ci->stop_encoder) 339 if (ci->stop_encoder)
352 break; 340 break;
353 341
354#ifdef HAVE_ADJUSTABLE_CPU_FREQ
355 if (!cpu_boosted && ci->enc_pcm_buf_near_empty() == 0)
356 {
357 ci->cpu_boost(true);
358 cpu_boosted = true;
359 }
360#endif
361 chunk = ci->enc_get_chunk(); 342 chunk = ci->enc_get_chunk();
362 chunk->enc_size = enc_size; 343 chunk->enc_size = enc_size;
363 chunk->num_pcm = PCM_SAMP_PER_CHUNK; 344 chunk->num_pcm = PCM_SAMP_PER_CHUNK;
@@ -369,21 +350,9 @@ enum codec_status codec_main(void)
369 ci->yield(); 350 ci->yield();
370 } 351 }
371 352
372#ifdef HAVE_ADJUSTABLE_CPU_FREQ
373 if (cpu_boosted && ci->enc_pcm_buf_near_empty() != 0)
374 {
375 ci->cpu_boost(false);
376 cpu_boosted = false;
377 }
378#endif
379 ci->yield(); 353 ci->yield();
380 } 354 }
381 355
382#ifdef HAVE_ADJUSTABLE_CPU_FREQ
383 if (cpu_boosted) /* set initial boost state */
384 ci->cpu_boost(false);
385#endif
386
387 /* reset parameters to initial state */ 356 /* reset parameters to initial state */
388 ci->enc_set_parameters(NULL); 357 ci->enc_set_parameters(NULL);
389 358
diff --git a/apps/codecs/wavpack_enc.c b/apps/codecs/wavpack_enc.c
index cf58a5973a..70261e70e2 100644
--- a/apps/codecs/wavpack_enc.c
+++ b/apps/codecs/wavpack_enc.c
@@ -343,9 +343,6 @@ static bool init_encoder(void)
343 ci->enc_set_parameters == NULL || 343 ci->enc_set_parameters == NULL ||
344 ci->enc_get_chunk == NULL || 344 ci->enc_get_chunk == NULL ||
345 ci->enc_finish_chunk == NULL || 345 ci->enc_finish_chunk == NULL ||
346#ifdef HAVE_ADJUSTABLE_CPU_FREQ
347 ci->enc_pcm_buf_near_empty == NULL ||
348#endif
349 ci->enc_get_pcm_data == NULL || 346 ci->enc_get_pcm_data == NULL ||
350 ci->enc_unget_pcm_data == NULL ) 347 ci->enc_unget_pcm_data == NULL )
351 return false; 348 return false;
@@ -386,10 +383,6 @@ static bool init_encoder(void)
386 383
387enum codec_status codec_main(void) 384enum codec_status codec_main(void)
388{ 385{
389#ifdef HAVE_ADJUSTABLE_CPU_FREQ
390 bool cpu_boosted;
391#endif
392
393 /* initialize params and config */ 386 /* initialize params and config */
394 if (!init_encoder()) 387 if (!init_encoder())
395 { 388 {
@@ -400,11 +393,6 @@ enum codec_status codec_main(void)
400 /* main application waits for this flag during encoder loading */ 393 /* main application waits for this flag during encoder loading */
401 ci->enc_codec_loaded = 1; 394 ci->enc_codec_loaded = 1;
402 395
403#ifdef HAVE_ADJUSTABLE_CPU_FREQ
404 ci->cpu_boost(true);
405 cpu_boosted = true;
406#endif
407
408 /* main encoding loop */ 396 /* main encoding loop */
409 while(!ci->stop_encoder) 397 while(!ci->stop_encoder)
410 { 398 {
@@ -422,13 +410,6 @@ enum codec_status codec_main(void)
422 410
423 abort_chunk = true; 411 abort_chunk = true;
424 412
425#ifdef HAVE_ADJUSTABLE_CPU_FREQ
426 if (!cpu_boosted && ci->enc_pcm_buf_near_empty() == 0)
427 {
428 ci->cpu_boost(true);
429 cpu_boosted = true;
430 }
431#endif
432 chunk = ci->enc_get_chunk(); 413 chunk = ci->enc_get_chunk();
433 414
434 /* reset counts and pointer */ 415 /* reset counts and pointer */
@@ -472,21 +453,9 @@ enum codec_status codec_main(void)
472 } 453 }
473 } 454 }
474 455
475#ifdef HAVE_ADJUSTABLE_CPU_FREQ
476 if (cpu_boosted && ci->enc_pcm_buf_near_empty() != 0)
477 {
478 ci->cpu_boost(false);
479 cpu_boosted = false;
480 }
481#endif
482 ci->yield(); 456 ci->yield();
483 } 457 }
484 458
485#ifdef HAVE_ADJUSTABLE_CPU_FREQ
486 if (cpu_boosted) /* set initial boost state */
487 ci->cpu_boost(false);
488#endif
489
490 /* reset parameters to initial state */ 459 /* reset parameters to initial state */
491 ci->enc_set_parameters(NULL); 460 ci->enc_set_parameters(NULL);
492 461
diff --git a/firmware/export/enc_base.h b/firmware/export/enc_base.h
index c7c30d66c0..ba8573a4f1 100644
--- a/firmware/export/enc_base.h
+++ b/firmware/export/enc_base.h
@@ -275,8 +275,6 @@ void enc_set_parameters(struct enc_parameters *params);
275struct enc_chunk_hdr * enc_get_chunk(void); 275struct enc_chunk_hdr * enc_get_chunk(void);
276/* releases the current chunk into the available chunks */ 276/* releases the current chunk into the available chunks */
277void enc_finish_chunk(void); 277void enc_finish_chunk(void);
278/* checks near empty state on pcm input buffer */
279int enc_pcm_buf_near_empty(void);
280 278
281#define PCM_MAX_FEED_SIZE 20000 /* max pcm size passed to encoder */ 279#define PCM_MAX_FEED_SIZE 20000 /* max pcm size passed to encoder */
282 280
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c
index c2d2719d05..1437b438ba 100644
--- a/firmware/pcm_record.c
+++ b/firmware/pcm_record.c
@@ -108,17 +108,16 @@ static unsigned long pre_record_ticks; /* pre-record time in ticks */
108 3.encoder: enc_set_parameters(); set the encoder parameters 108 3.encoder: enc_set_parameters(); set the encoder parameters
109 4.encoder: enc_get_pcm_data(); get n bytes of unprocessed pcm data 109 4.encoder: enc_get_pcm_data(); get n bytes of unprocessed pcm data
110 5.encoder: enc_unget_pcm_data(); put n bytes of data back (optional) 110 5.encoder: enc_unget_pcm_data(); put n bytes of data back (optional)
111 6.encoder: enc_pcm_buf_near_empty(); if !0: reduce cpu_boost 111 6.encoder: enc_get_chunk(); get a ptr to next enc chunk
112 7.encoder: enc_get_chunk(); get a ptr to next enc chunk 112 7.encoder: <process enc chunk> compress and store data to enc chunk
113 8.encoder: <process enc chunk> compress and store data to enc chunk 113 8.encoder: enc_finish_chunk(); inform main about chunk processed and
114 9.encoder: enc_finish_chunk(); inform main about chunk processed and
115 is available to be written to a file. 114 is available to be written to a file.
116 Encoder can place any number of chunks 115 Encoder can place any number of chunks
117 of PCM data in a single output chunk 116 of PCM data in a single output chunk
118 but must stay within its output chunk 117 but must stay within its output chunk
119 size 118 size
120 A.encoder: repeat 4. to 9. 119 9.encoder: repeat 4. to 8.
121 B.pcmrec: enc_events_callback(); called for certain events 120 A.pcmrec: enc_events_callback(); called for certain events
122 121
123 (*) Optional step 122 (*) Optional step
124****************************************************************************/ 123****************************************************************************/
@@ -1541,6 +1540,7 @@ void enc_set_parameters(struct enc_parameters *params)
1541 /* Encoder is terminating */ 1540 /* Encoder is terminating */
1542 memset(&enc_config, 0, sizeof (enc_config)); 1541 memset(&enc_config, 0, sizeof (enc_config));
1543 enc_sample_rate = 0; 1542 enc_sample_rate = 0;
1543 cancel_cpu_boost(); /* Make sure no boost remains */
1544 return; 1544 return;
1545 } 1545 }
1546 1546
@@ -1709,15 +1709,6 @@ void enc_finish_chunk(void)
1709 } 1709 }
1710} /* enc_finish_chunk */ 1710} /* enc_finish_chunk */
1711 1711
1712/* checks near empty state on pcm input buffer */
1713int enc_pcm_buf_near_empty(void)
1714{
1715 /* less than 1sec raw data? => unboost encoder */
1716 int wp = dma_wr_pos;
1717 size_t avail = (wp - pcm_rd_pos) & PCM_CHUNK_MASK;
1718 return avail < (sample_rate << 2) ? 1 : 0;
1719} /* enc_pcm_buf_near_empty */
1720
1721/* passes a pointer to next chunk of unprocessed wav data */ 1712/* passes a pointer to next chunk of unprocessed wav data */
1722/* TODO: this really should give the actual size returned */ 1713/* TODO: this really should give the actual size returned */
1723unsigned char * enc_get_pcm_data(size_t size) 1714unsigned char * enc_get_pcm_data(size_t size)
@@ -1744,12 +1735,24 @@ unsigned char * enc_get_pcm_data(size_t size)
1744 pcm_buffer, pcm_rd_pos); 1735 pcm_buffer, pcm_rd_pos);
1745 } 1736 }
1746 1737
1738 if (avail >= (sample_rate << 2))
1739 {
1740 /* Filling up - boost codec */
1741 trigger_cpu_boost();
1742 }
1743
1747 pcm_buffer_empty = false; 1744 pcm_buffer_empty = false;
1748 return ptr; 1745 return ptr;
1749 } 1746 }
1750 1747
1751 /* not enough data available - encoder should idle */ 1748 /* not enough data available - encoder should idle */
1752 pcm_buffer_empty = true; 1749 pcm_buffer_empty = true;
1750
1751 cancel_cpu_boost();
1752
1753 /* Sleep long enough to allow one frame on average */
1754 sleep(0);
1755
1753 return NULL; 1756 return NULL;
1754} /* enc_get_pcm_data */ 1757} /* enc_get_pcm_data */
1755 1758