* 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:
@@ -273,20 +273,16 @@ SoundPlayNode::SetBufferGroup(const media_source& forSource,
|
|||||||
// group, otherwise we'll deadlock waiting for that buffer to be recycled!
|
// group, otherwise we'll deadlock waiting for that buffer to be recycled!
|
||||||
delete fBufferGroup;
|
delete fBufferGroup;
|
||||||
// waits for all buffers to recycle
|
// waits for all buffers to recycle
|
||||||
|
|
||||||
if (newGroup != NULL) {
|
if (newGroup != NULL) {
|
||||||
// we were given a valid group; just use that one from now on
|
// we were given a valid group; just use that one from now on
|
||||||
fBufferGroup = newGroup;
|
fBufferGroup = newGroup;
|
||||||
} else {
|
return B_OK;
|
||||||
// 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;
|
// 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()
|
SoundPlayNode::AllocateBuffers()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
@@ -809,6 +805,8 @@ SoundPlayNode::AllocateBuffers()
|
|||||||
ERROR("SoundPlayNode::AllocateBuffers: BufferGroup::InitCheck() "
|
ERROR("SoundPlayNode::AllocateBuffers: BufferGroup::InitCheck() "
|
||||||
"failed\n");
|
"failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return fBufferGroup->InitCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ protected:
|
|||||||
bigtime_t lateness,
|
bigtime_t lateness,
|
||||||
bool realTimeEvent = false);
|
bool realTimeEvent = false);
|
||||||
|
|
||||||
void AllocateBuffers();
|
status_t AllocateBuffers();
|
||||||
BBuffer* FillNextBuffer(bigtime_t eventTime);
|
BBuffer* FillNextBuffer(bigtime_t eventTime);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user