mirror of https://github.com/encounter/SDL.git
Android/openslES: prevent to run out of buffers if Enqueue() fails.
This commit is contained in:
parent
40781dfb15
commit
bf823bf2dc
|
@ -549,19 +549,21 @@ openslES_PlayDevice(_THIS)
|
||||||
SLresult result;
|
SLresult result;
|
||||||
|
|
||||||
LOGI("======openslES_PlayDevice( )======");
|
LOGI("======openslES_PlayDevice( )======");
|
||||||
/* Queue it up */
|
|
||||||
|
|
||||||
|
/* Queue it up */
|
||||||
result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, audiodata->pmixbuff[audiodata->next_buffer], this->spec.size);
|
result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, audiodata->pmixbuff[audiodata->next_buffer], this->spec.size);
|
||||||
if (SL_RESULT_SUCCESS != result) {
|
|
||||||
/* just puk here */
|
|
||||||
/* next ! */
|
|
||||||
}
|
|
||||||
|
|
||||||
audiodata->next_buffer++;
|
audiodata->next_buffer++;
|
||||||
if (audiodata->next_buffer >= NUM_BUFFERS) {
|
if (audiodata->next_buffer >= NUM_BUFFERS) {
|
||||||
audiodata->next_buffer = 0;
|
audiodata->next_buffer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If Enqueue fails, callback won't be called.
|
||||||
|
* Post the semphore, not to run out of buffer */
|
||||||
|
if (SL_RESULT_SUCCESS != result) {
|
||||||
|
SDL_SemPost(audiodata->playsem);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue