Update RageSoundDriver_AU.cpp
The Yosemite crash happens when we call CFRunLoopAddObserver. It doesn't seem to like runLoopRef. Replacing the first argument to this call with CFRunLoopGetCurrent() avoids the crash, but the app then hangs because CFRunLoopWakeUp doesn't cause observerRef (NameHALThread) to fire, so the semaphore is not posted. Commenting the semaphore wait line allows the game to boot in Yosemite, and seems to play totally normally. This doesn't really fix our problem (we are trying to name the HAL thread, and a catastrophic error occurs), but it shows us what the problem is. We are obtaining runLoopRef using an API call that was deprecated years ago. However, the Apple-approved replacement code doesn't produce a runLoopRef that avoids the crash, either. So I'm not sure how we get the correct runLoopRef so we can name the thread. This is my first time looking at the code base, but I don't see the value of naming the thread. In the interest of keeping Stepmania compatible with the upcoming operating system, I propose we just remove the thread-naming logic.
This commit is contained in:
@@ -45,16 +45,6 @@ RageSoundDriver_AU::RageSoundDriver_AU() : m_OutputUnit(NULL), m_iSampleRate(0),
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void RageSoundDriver_AU::NameHALThread( CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *inRefCon )
|
||||
{
|
||||
RageSoundDriver_AU *This = (RageSoundDriver_AU *)inRefCon;
|
||||
CFRunLoopObserverInvalidate( observer );
|
||||
CFRelease( observer );
|
||||
This->m_pNotificationThread = new RageThreadRegister( "HAL notification thread" );
|
||||
This->m_Semaphore.Post();
|
||||
}
|
||||
|
||||
static void SetSampleRate( AudioUnit au, Float64 desiredRate )
|
||||
{
|
||||
AudioDeviceID OutputDevice;
|
||||
@@ -200,22 +190,6 @@ RString RageSoundDriver_AU::Init()
|
||||
|
||||
StartDecodeThread();
|
||||
|
||||
// Get the HAL's runloop and attach an observer.
|
||||
{
|
||||
CFRunLoopObserverRef observerRef;
|
||||
CFRunLoopRef runLoopRef;
|
||||
CFRunLoopObserverContext context = { 0, this, NULL, NULL, NULL };
|
||||
UInt32 size = sizeof( CFRunLoopRef );
|
||||
|
||||
if( (error = AudioHardwareGetProperty(kAudioHardwarePropertyRunLoop, &size, &runLoopRef)) )
|
||||
return ERROR( "Couldn't get the HAL's run loop", error);
|
||||
|
||||
observerRef = CFRunLoopObserverCreate( kCFAllocatorDefault, kCFRunLoopAllActivities, false, 0, NameHALThread, &context );
|
||||
CFRunLoopAddObserver( runLoopRef, observerRef, kCFRunLoopDefaultMode );
|
||||
CFRunLoopWakeUp( runLoopRef );
|
||||
m_Semaphore.Wait();
|
||||
}
|
||||
|
||||
if( (error = AudioOutputUnitStart(m_OutputUnit)) )
|
||||
return ERROR( "Could not start the AudioUnit", error );
|
||||
m_bStarted = true;
|
||||
|
||||
Reference in New Issue
Block a user