added an additional sanity check

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3732 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper 2003-06-29 14:55:46 +00:00
parent 7d970b3122
commit cb595db745

View File

@ -196,7 +196,12 @@ AudioMixer::BufferReceived(BBuffer *buffer)
return; return;
} }
// printf("buffer received at %12Ld, should arrive at %12Ld, delta %12Ld\n", TimeSource()->Now(), buffer->Header()->start_time, TimeSource()->Now() - buffer->Header()->start_time); //printf("buffer received at %12Ld, should arrive at %12Ld, delta %12Ld\n", TimeSource()->Now(), buffer->Header()->start_time, TimeSource()->Now() - buffer->Header()->start_time);
// HandleInputBuffer(buffer, 0);
// buffer->Recycle();
// return;
// to receive the buffer at the right time, // to receive the buffer at the right time,
// push it through the event looper // push it through the event looper
@ -223,6 +228,8 @@ AudioMixer::HandleInputBuffer(BBuffer *buffer, bigtime_t lateness)
} }
} }
*/ */
// printf("Received buffer with lateness %Ld\n", lateness);
fCore->Lock(); fCore->Lock();
fCore->BufferReceived(buffer, lateness); fCore->BufferReceived(buffer, lateness);
@ -610,6 +617,15 @@ AudioMixer::Connect(status_t error, const media_source &source, const media_dest
{ {
printf("AudioMixer::Connect\n"); printf("AudioMixer::Connect\n");
fCore->Lock();
// are we still connected?
if (fCore->Output() == 0) {
fCore->Unlock();
ERROR("AudioMixer::Connect: no longer connected\n");
return;
}
fCore->Unlock();
if (error != B_OK) { if (error != B_OK) {
// if an error occured, remove output from core // if an error occured, remove output from core
printf("AudioMixer::Connect failed with error 0x%08lX, removing connction\n", error); printf("AudioMixer::Connect failed with error 0x%08lX, removing connction\n", error);
@ -618,7 +634,7 @@ AudioMixer::Connect(status_t error, const media_source &source, const media_dest
fCore->Unlock(); fCore->Unlock();
return; return;
} }
// if the connection has no name, we set it now // if the connection has no name, we set it now
if (strlen(io_name) == 0) if (strlen(io_name) == 0)
strcpy(io_name, "Mixer Output"); strcpy(io_name, "Mixer Output");