QAlsaAudioOutput remove async callback.

The async callback mechanism in ALSA is prone to deadlock.
There was already a timer fallback mechanism that appears to be
sufficient.

Task-number: QTBUG-39677
Change-Id: I44b59e6b16eea1c9c4eeb6967335ce4f468cf3c4
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Dyami Caliri
2014-06-17 07:45:34 -07:00
committed by Yoann Lopes
parent a391ad4763
commit a63da4b593
2 changed files with 1 additions and 33 deletions

View File

@@ -63,7 +63,6 @@ QAlsaAudioOutput::QAlsaAudioOutput(const QByteArray &device)
{
bytesAvailable = 0;
handle = 0;
ahandler = 0;
access = SND_PCM_ACCESS_RW_INTERLEAVED;
pcmformat = SND_PCM_FORMAT_S16;
buffer_frames = 0;
@@ -118,17 +117,6 @@ QAudio::State QAlsaAudioOutput::state() const
return deviceState;
}
void QAlsaAudioOutput::async_callback(snd_async_handler_t *ahandler)
{
QAlsaAudioOutput* audioOut;
audioOut = static_cast<QAlsaAudioOutput*>
(snd_async_handler_get_callback_private(ahandler));
if (audioOut && (audioOut->deviceState == QAudio::ActiveState || audioOut->resuming))
audioOut->feedback();
}
int QAlsaAudioOutput::xrun_recovery(int err)
{
int count = 0;
@@ -512,8 +500,7 @@ bool QAlsaAudioOutput::open()
snd_pcm_prepare( handle );
snd_pcm_start(handle);
// Step 5: Setup callback and timer fallback
snd_async_add_pcm_handler(&ahandler, handle, async_callback, this);
// Step 5: Setup timer
bytesAvailable = bytesFree();
// Step 6: Start audio processing
@@ -715,21 +702,6 @@ void QAlsaAudioOutput::userFeed()
deviceReady();
}
void QAlsaAudioOutput::feedback()
{
updateAvailable();
}
void QAlsaAudioOutput::updateAvailable()
{
#ifdef DEBUG_AUDIO
QTime now(QTime::currentTime());
qDebug()<<now.second()<<"s "<<now.msec()<<"ms :updateAvailable()";
#endif
bytesAvailable = bytesFree();
}
bool QAlsaAudioOutput::deviceReady()
{
if(pullMode) {

View File

@@ -107,8 +107,6 @@ public:
private slots:
void userFeed();
void feedback();
void updateAvailable();
bool deviceReady();
signals:
@@ -126,7 +124,6 @@ private:
unsigned int period_time;
snd_pcm_uframes_t buffer_frames;
snd_pcm_uframes_t period_frames;
static void async_callback(snd_async_handler_t *ahandler);
int xrun_recovery(int err);
int setFormat();
@@ -141,7 +138,6 @@ private:
qint64 elapsedTimeOffset;
char* audioBuffer;
snd_pcm_t* handle;
snd_async_handler_t* ahandler;
snd_pcm_access_t access;
snd_pcm_format_t pcmformat;
snd_timestamp_t* timestamp;