forked from len0rd/rockbox
Lua Add Emergency Garbage Collector
Derivative of work by RobertGabrielJakabosky http://lua-users.org/wiki/EmergencyGarbageCollector I've only implemented the not enough memory part and expanded this idea to adding a mechanism to signal the OOM condition of the plugin buffer which allows us to only grab the playback buffer after garbage collection fails (SO THE MUSIC KEEPS PLAYING AS LONG AS POSSIBLE) Change-Id: I684fb98b540ffc01f7ba324ab5b761ceb59b9f9b
This commit is contained in:
parent
4beafe16fa
commit
45bd14b392
21 changed files with 266 additions and 68 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "plugin.h"
|
||||
#include <tlsf.h>
|
||||
#include "lua.h"
|
||||
|
||||
void *get_new_area(size_t *size)
|
||||
{
|
||||
|
@ -36,7 +37,8 @@ void *get_new_area(size_t *size)
|
|||
return pluginbuf_ptr;
|
||||
}
|
||||
|
||||
if (audiobuf_ptr == NULL)
|
||||
/* only grab the next area if lua already tried + failed to garbage collect*/
|
||||
if (audiobuf_ptr == NULL && (get_lua_OOM())->count > 0)
|
||||
{
|
||||
/* grab audiobuffer */
|
||||
audiobuf_ptr = rb->plugin_get_audio_buffer(size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue