Revert previous changes as they didn't help.
parent
4a80fa9496
commit
b94815abfa
|
@ -89,7 +89,6 @@ private:
|
|||
static thread_local void* Workgroup_;
|
||||
static thread_local void* JoinToken_;
|
||||
static thread_local int CurrentCoreAudioId_;
|
||||
std::atomic<int> numRealTimeThreads_;
|
||||
|
||||
static int DeviceIsAliveCallback_(
|
||||
AudioObjectID inObjectID,
|
||||
|
|
|
@ -261,10 +261,7 @@ void MacAudioDevice::start()
|
|||
onAudioDataFunction(*this, inputFrames_, frameCount, onAudioDataState);
|
||||
}
|
||||
|
||||
for (auto count = 0; count < numRealTimeThreads_; count++)
|
||||
{
|
||||
dispatch_semaphore_signal(sem_);
|
||||
}
|
||||
dispatch_semaphore_signal(sem_);
|
||||
|
||||
return OSStatus(noErr);
|
||||
};
|
||||
|
@ -638,8 +635,6 @@ void MacAudioDevice::setHelperRealTime()
|
|||
}
|
||||
else
|
||||
{
|
||||
numRealTimeThreads_++;
|
||||
|
||||
// Going real-time is a prerequisite for joining workgroups
|
||||
joinWorkgroup_();
|
||||
}
|
||||
|
@ -719,7 +714,6 @@ void MacAudioDevice::stopRealTimeWork()
|
|||
void MacAudioDevice::clearHelperRealTime()
|
||||
{
|
||||
leaveWorkgroup_();
|
||||
numRealTimeThreads_--;
|
||||
}
|
||||
|
||||
void MacAudioDevice::leaveWorkgroup_()
|
||||
|
|
|
@ -245,7 +245,6 @@ void PulseAudioDevice::setHelperRealTime()
|
|||
sigaddset(&signal_set, SIGXCPU);
|
||||
sigprocmask(SIG_UNBLOCK, &signal_set, NULL);
|
||||
#endif // 0
|
||||
numRealTimeThreads_++;
|
||||
}
|
||||
|
||||
void PulseAudioDevice::startRealTimeWork()
|
||||
|
@ -301,7 +300,6 @@ void PulseAudioDevice::stopRealTimeWork()
|
|||
void PulseAudioDevice::clearHelperRealTime()
|
||||
{
|
||||
IAudioDevice::clearHelperRealTime();
|
||||
numRealTimeThreads_--;
|
||||
}
|
||||
|
||||
bool PulseAudioDevice::mustStopWork()
|
||||
|
@ -326,11 +324,7 @@ void PulseAudioDevice::StreamReadCallback_(pa_stream *s, size_t length, void *us
|
|||
{
|
||||
thisObj->onAudioDataFunction(*thisObj, const_cast<void*>(data), length / thisObj->getNumChannels() / sizeof(short), thisObj->onAudioDataState);
|
||||
}
|
||||
|
||||
for (auto count = 0; count < thisObj->numRealTimeThreads_; count++)
|
||||
{
|
||||
sem_post(&thisObj->sem_);
|
||||
}
|
||||
sem_post(&thisObj->sem_);
|
||||
pa_stream_drop(s);
|
||||
} while (pa_stream_readable_size(s) > 0);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <wx/string.h>
|
||||
#include <pulse/pulseaudio.h>
|
||||
|
@ -87,7 +86,6 @@ private:
|
|||
|
||||
thread_local static std::chrono::high_resolution_clock::time_point StartTime_;
|
||||
thread_local static bool MustStopWork_;
|
||||
std::atomic<int> numRealTimeThreads_;
|
||||
|
||||
sem_t sem_;
|
||||
struct timespec ts_;
|
||||
|
|
|
@ -257,7 +257,7 @@ void WASAPIAudioDevice::start()
|
|||
}
|
||||
|
||||
// Create semaphore
|
||||
semaphore_ = CreateSemaphore(nullptr, 0, 1000, nullptr);
|
||||
semaphore_ = CreateSemaphore(nullptr, 0, 1, nullptr);
|
||||
if (semaphore_ == nullptr)
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
@ -407,10 +407,7 @@ void WASAPIAudioDevice::stop()
|
|||
// occurs!
|
||||
auto tmpSem = semaphore_;
|
||||
semaphore_ = nullptr;
|
||||
for (auto count = 0; count < numRealTimeThreads_; count++)
|
||||
{
|
||||
ReleaseSemaphore(tmpSem, 1, nullptr);
|
||||
}
|
||||
ReleaseSemaphore(tmpSem, 1, nullptr);
|
||||
CloseHandle(tmpSem);
|
||||
}
|
||||
|
||||
|
@ -439,8 +436,6 @@ void WASAPIAudioDevice::setHelperRealTime()
|
|||
{
|
||||
log_warn("Could not increase thread priority");
|
||||
}
|
||||
|
||||
numRealTimeThreads_++;
|
||||
}
|
||||
|
||||
void WASAPIAudioDevice::startRealTimeWork()
|
||||
|
@ -469,8 +464,6 @@ void WASAPIAudioDevice::stopRealTimeWork()
|
|||
|
||||
void WASAPIAudioDevice::clearHelperRealTime()
|
||||
{
|
||||
numRealTimeThreads_--;
|
||||
|
||||
if (HelperTask_ != nullptr)
|
||||
{
|
||||
AvRevertMmThreadCharacteristics(HelperTask_);
|
||||
|
@ -621,9 +614,6 @@ void WASAPIAudioDevice::captureAudio_()
|
|||
if (semaphore_ != nullptr)
|
||||
{
|
||||
// Notify worker threads
|
||||
for (auto count = 0; count < numRealTimeThreads_; count++)
|
||||
{
|
||||
ReleaseSemaphore(semaphore_, 1, nullptr);
|
||||
}
|
||||
ReleaseSemaphore(semaphore_, 1, nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ private:
|
|||
HANDLE renderCaptureEvent_;
|
||||
bool isRenderCaptureRunning_;
|
||||
HANDLE semaphore_;
|
||||
std::atomic<int> numRealTimeThreads_;
|
||||
|
||||
void renderAudio_();
|
||||
void captureAudio_();
|
||||
|
|
Loading…
Reference in New Issue