forked from len0rd/rockbox
A bit of work in the pcm driver. Should be a bit more efficient, but more importantly more dependable. Stopping playback now properly recovers if playback crashed for some reason (shouldn't happen of course).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27698 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c216100f84
commit
bd9c0b21d6
2 changed files with 41 additions and 32 deletions
|
|
@ -72,7 +72,10 @@ Java_org_rockbox_RockboxPCM_pcmSamplesToByteArray(JNIEnv *env,
|
|||
retry:
|
||||
pcm_play_get_more_callback((void**)&pcm_data_start, &pcm_data_size);
|
||||
if (pcm_data_size == 0)
|
||||
{
|
||||
LOG("out of data\n");
|
||||
return;
|
||||
}
|
||||
if (remaining > pcm_data_size)
|
||||
{ /* got too little data, get more ... */
|
||||
(*env)->SetByteArrayRegion(env, arr, offset, pcm_data_size, pcm_data_start);
|
||||
|
|
@ -80,6 +83,7 @@ Java_org_rockbox_RockboxPCM_pcmSamplesToByteArray(JNIEnv *env,
|
|||
offset += pcm_data_size;
|
||||
/* we copied at least a bit */
|
||||
remaining -= pcm_data_size;
|
||||
pcm_data_size = 0;
|
||||
/* let's get another buch of data and try again */
|
||||
goto retry;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue