Always wait for buffers in AudioProducer::_FillNextBuffer().

Seems to work around a problem in the system mixer. When it
happens once that the AudioProducer does not send a buffer,
then it can eventually lead to a drop into the debugger
from BBuffer::SetHeader(), which to me looks like the BMediaEventLooper
thread of the mixer still runs when the System Mixer has been
shut down, which itself is yet another problem. I shall
investigate, but for the time being, one should enjoy a more
stable media_addon_server life-time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38664 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-09-15 22:23:50 +00:00
parent 8eb72c7217
commit 05e6afd6ea

View File

@ -645,13 +645,13 @@ printf("B_START: start time: %lld\n", fStartTime);
if (RunState() == BMediaEventLooper::B_STARTED if (RunState() == BMediaEventLooper::B_STARTED
&& fOutput.destination != media_destination::null) { && fOutput.destination != media_destination::null) {
BBuffer* buffer = _FillNextBuffer(event->event_time); BBuffer* buffer = _FillNextBuffer(event->event_time);
if (buffer) { if (buffer != NULL) {
status_t err = B_ERROR; status_t err = B_ERROR;
if (fOutputEnabled) { if (fOutputEnabled) {
err = SendBuffer(buffer, fOutput.source, err = SendBuffer(buffer, fOutput.source,
fOutput.destination); fOutput.destination);
} }
if (err) if (err != B_OK)
buffer->Recycle(); buffer->Recycle();
} }
size_t sampleSize = fOutput.format.u.raw_audio.format size_t sampleSize = fOutput.format.u.raw_audio.format
@ -810,6 +810,7 @@ AudioProducer::_AllocateBuffers(const media_format& format)
BBuffer* BBuffer*
AudioProducer::_FillNextBuffer(bigtime_t eventTime) AudioProducer::_FillNextBuffer(bigtime_t eventTime)
{ {
fBufferGroup->WaitForBuffers();
BBuffer* buffer = fBufferGroup->RequestBuffer( BBuffer* buffer = fBufferGroup->RequestBuffer(
fOutput.format.u.raw_audio.buffer_size, BufferDuration()); fOutput.format.u.raw_audio.buffer_size, BufferDuration());