Apply patch by bkmx from ticket #5093 : fixes some buffer index math in

BPushGameSound so at least it doesn't crashes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43064 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2011-11-01 14:31:08 +00:00
parent 5fd0416842
commit 0044a8c39a

View File

@ -15,9 +15,13 @@
#include "GSUtility.h"
BPushGameSound::BPushGameSound(size_t inBufferFrameCount, const gs_audio_format *format,
size_t inBufferCount, BGameSoundDevice *device)
: BStreamingGameSound(inBufferFrameCount, format, inBufferCount, device)
BPushGameSound::BPushGameSound(size_t inBufferFrameCount,
const gs_audio_format *format, size_t inBufferCount,
BGameSoundDevice *device)
:
BStreamingGameSound(inBufferFrameCount, format, inBufferCount, device),
fLockPos(0),
fPlayPos(0)
{
fPageLocked = new BList;
@ -137,8 +141,8 @@ BPushGameSound::SetParameters(size_t inBufferFrameCount,
status_t
BPushGameSound::SetStreamHook(void (*hook)(void * inCookie, void * inBuffer, size_t inByteCount, BStreamingGameSound * me),
void * cookie)
BPushGameSound::SetStreamHook(void (*hook)(void * inCookie, void * inBuffer,
size_t inByteCount, BStreamingGameSound * me), void * cookie)
{
return B_UNSUPPORTED;
}
@ -153,7 +157,8 @@ BPushGameSound::FillBuffer(void *inBuffer, size_t inByteCount)
return;
if (fPlayPos + bytes > fBufferSize) {
size_t remainder = fPlayPos + bytes - fBufferSize;
size_t remainder = fBufferSize - fPlayPos;
// Space left in buffer
char * buffer = (char*)inBuffer;
// fill the buffer with the samples left at the end of our buffer