Use QAtomicInt::load() and ::store()
The operator=(int) and implicit int cast operators are deprecated and will be removed. Change-Id: I5091d705fba45195239c901f210355e09e123faa Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
e3a8c165ea
commit
fbac3a0647
@@ -105,12 +105,12 @@ QAudioRingBuffer::~QAudioRingBuffer()
|
|||||||
|
|
||||||
int QAudioRingBuffer::used() const
|
int QAudioRingBuffer::used() const
|
||||||
{
|
{
|
||||||
return m_bufferUsed;
|
return m_bufferUsed.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
int QAudioRingBuffer::free() const
|
int QAudioRingBuffer::free() const
|
||||||
{
|
{
|
||||||
return m_bufferSize - m_bufferUsed;
|
return m_bufferSize - m_bufferUsed.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
int QAudioRingBuffer::size() const
|
int QAudioRingBuffer::size() const
|
||||||
@@ -122,7 +122,7 @@ void QAudioRingBuffer::reset()
|
|||||||
{
|
{
|
||||||
m_readPos = 0;
|
m_readPos = 0;
|
||||||
m_writePos = 0;
|
m_writePos = 0;
|
||||||
m_bufferUsed = 0;
|
m_bufferUsed.store(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -894,14 +894,14 @@ void QAudioInputPrivate::audioThreadStop()
|
|||||||
void QAudioInputPrivate::audioThreadStart()
|
void QAudioInputPrivate::audioThreadStart()
|
||||||
{
|
{
|
||||||
startTimers();
|
startTimers();
|
||||||
audioThreadState = Running;
|
audioThreadState.store(Running);
|
||||||
AudioOutputUnitStart(audioUnit);
|
AudioOutputUnitStart(audioUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAudioInputPrivate::audioDeviceStop()
|
void QAudioInputPrivate::audioDeviceStop()
|
||||||
{
|
{
|
||||||
AudioOutputUnitStop(audioUnit);
|
AudioOutputUnitStop(audioUnit);
|
||||||
audioThreadState = Stopped;
|
audioThreadState.store(Stopped);
|
||||||
threadFinished.wakeOne();
|
threadFinished.wakeOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,7 +960,7 @@ OSStatus QAudioInputPrivate::inputCallback(void* inRefCon,
|
|||||||
|
|
||||||
QAudioInputPrivate* d = static_cast<QAudioInputPrivate*>(inRefCon);
|
QAudioInputPrivate* d = static_cast<QAudioInputPrivate*>(inRefCon);
|
||||||
|
|
||||||
const int threadState = d->audioThreadState.fetchAndAddAcquire(0);
|
const int threadState = d->audioThreadState.loadAcquire();
|
||||||
if (threadState == Stopped)
|
if (threadState == Stopped)
|
||||||
d->audioDeviceStop();
|
d->audioDeviceStop();
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray& device)
|
|||||||
clockFrequency = AudioGetHostClockFrequency() / 1000;
|
clockFrequency = AudioGetHostClockFrequency() / 1000;
|
||||||
errorCode = QAudio::NoError;
|
errorCode = QAudio::NoError;
|
||||||
stateCode = QAudio::StoppedState;
|
stateCode = QAudio::StoppedState;
|
||||||
audioThreadState = Stopped;
|
audioThreadState.store(Stopped);
|
||||||
|
|
||||||
intervalTimer = new QTimer(this);
|
intervalTimer = new QTimer(this);
|
||||||
intervalTimer->setInterval(1000);
|
intervalTimer->setInterval(1000);
|
||||||
@@ -599,7 +599,7 @@ QAudio::State QAudioOutputPrivate::state() const
|
|||||||
void QAudioOutputPrivate::audioThreadStart()
|
void QAudioOutputPrivate::audioThreadStart()
|
||||||
{
|
{
|
||||||
startTimers();
|
startTimers();
|
||||||
audioThreadState = Running;
|
audioThreadState.store(Running);
|
||||||
AudioOutputUnitStart(audioUnit);
|
AudioOutputUnitStart(audioUnit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,7 +620,7 @@ void QAudioOutputPrivate::audioThreadDrain()
|
|||||||
void QAudioOutputPrivate::audioDeviceStop()
|
void QAudioOutputPrivate::audioDeviceStop()
|
||||||
{
|
{
|
||||||
AudioOutputUnitStop(audioUnit);
|
AudioOutputUnitStop(audioUnit);
|
||||||
audioThreadState = Stopped;
|
audioThreadState.store(Stopped);
|
||||||
threadFinished.wakeOne();
|
threadFinished.wakeOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user