Don't completely fill the psmf ringbuffer at once.

It takes more time (slowing the start of the video), and gets us closer to
overflowing buffers and stuff.
This commit is contained in:
Unknown W. Brackets 2014-01-04 01:23:44 -08:00
parent 0de71f27cb
commit f095ac656b

View File

@ -861,16 +861,21 @@ int _PsmfPlayerFillRingbuffer(PsmfPlayer *psmfplayer) {
if (!psmfplayer->filehandle || !psmfplayer->tempbuf)
return -1;
u8* buf = psmfplayer->tempbuf;
u32 tempbufSize = sizeof(psmfplayer->tempbuf);
int tempbufSize = (int)sizeof(psmfplayer->tempbuf);
int size;
// Let's not burn a bunch of time adding data all at once.
int addMax = std::max(2048 * 100, tempbufSize);
do {
size = std::min(psmfplayer->mediaengine->getRemainSize(), (int)tempbufSize);
size = std::min(psmfplayer->mediaengine->getRemainSize(), tempbufSize);
size = std::min(psmfplayer->streamSize - psmfplayer->readSize, size);
if (size <= 0)
break;
size = (int)pspFileSystem.ReadFile(psmfplayer->filehandle, buf, size);
psmfplayer->readSize += size;
psmfplayer->mediaengine->addStreamData(buf, size);
addMax -= size;
if (addMax <= 0)
break;
} while (size > 0);
if (psmfplayer->readSize >= psmfplayer->streamSize && videoLoopStatus == PSMF_PLAYER_CONFIG_LOOP) {
// start looping