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