* Removed code duplication, SetBufferGroup() will now use AllocateBuffers()
instead of doing the same manually. * AllocateBuffers() is now returning a status code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34499 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ca8b3261b1
commit
04c71a2f1d
@ -273,20 +273,16 @@ SoundPlayNode::SetBufferGroup(const media_source& forSource,
|
||||
// group, otherwise we'll deadlock waiting for that buffer to be recycled!
|
||||
delete fBufferGroup;
|
||||
// waits for all buffers to recycle
|
||||
|
||||
if (newGroup != NULL) {
|
||||
// we were given a valid group; just use that one from now on
|
||||
fBufferGroup = newGroup;
|
||||
} else {
|
||||
// we were passed a NULL group pointer; that means we construct
|
||||
// our own buffer group to use from now on
|
||||
size_t size = fOutput.format.u.raw_audio.buffer_size;
|
||||
int32 count = int32(fLatency / BufferDuration() + 1 + 1);
|
||||
if (count < 3)
|
||||
count = 3;
|
||||
fBufferGroup = new BBufferGroup(size, count);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
// we were passed a NULL group pointer; that means we construct
|
||||
// our own buffer group to use from now on
|
||||
return AllocateBuffers();
|
||||
}
|
||||
|
||||
|
||||
@ -786,7 +782,7 @@ SoundPlayNode::HandleParameter(const media_timed_event* event,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
status_t
|
||||
SoundPlayNode::AllocateBuffers()
|
||||
{
|
||||
CALLED();
|
||||
@ -809,6 +805,8 @@ SoundPlayNode::AllocateBuffers()
|
||||
ERROR("SoundPlayNode::AllocateBuffers: BufferGroup::InitCheck() "
|
||||
"failed\n");
|
||||
}
|
||||
|
||||
return fBufferGroup->InitCheck();
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ protected:
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
|
||||
void AllocateBuffers();
|
||||
status_t AllocateBuffers();
|
||||
BBuffer* FillNextBuffer(bigtime_t eventTime);
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user