1
0
Fork 0
forked from len0rd/rockbox

Fix audio_get_buffer() implementation on hwcodec, to be similar to the swcodec one. Should make hwcodec bood again.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30737 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-10-09 12:30:37 +00:00
parent aed39dbbaf
commit 889690c0f6
2 changed files with 11 additions and 5 deletions

View file

@ -558,8 +558,10 @@ unsigned char * audio_get_buffer(bool talk_buf, size_t *buffer_size)
{ {
(void)talk_buf; /* always grab the voice buffer for now */ (void)talk_buf; /* always grab the voice buffer for now */
if (buffer_size) /* special case for talk_init() */ audio_hard_stop();
audio_hard_stop();
if (!buffer_size) /* special case for talk_init() */
return NULL;
if (!audiobuf_handle) if (!audiobuf_handle)
{ {
@ -571,9 +573,9 @@ unsigned char * audio_get_buffer(bool talk_buf, size_t *buffer_size)
*buffer_size = audiobuflen; *buffer_size = audiobuflen;
} }
mpeg_audiobuf = core_get_data(audiobuf_handle); mpeg_audiobuf = core_get_data(audiobuf_handle);
/* tell talk about the new buffer, don't re-enable just yet because the
if (!buffer_size) /* special case for talk_init() */ * buffer is stolen */
talkbuf_init(mpeg_audiobuf); talkbuf_init(mpeg_audiobuf);
return mpeg_audiobuf; return mpeg_audiobuf;
} }

View file

@ -628,7 +628,11 @@ buflib_alloc_maximum(struct buflib_context* ctx, const char* name, size_t *size,
{ {
/* limit name to 16 since that's what buflib_available() accounts for it */ /* limit name to 16 since that's what buflib_available() accounts for it */
char buf[16]; char buf[16];
*size = buflib_available(ctx); *size = buflib_available(ctx);
if (*size <= 0) /* OOM */
return -1;
strlcpy(buf, name, sizeof(buf)); strlcpy(buf, name, sizeof(buf));
return buflib_alloc_ex(ctx, *size, buf, ops); return buflib_alloc_ex(ctx, *size, buf, ops);