diff options
author | Dyami Caliri <dyami@dragonframe.com> | 2014-06-17 07:45:34 -0700 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@digia.com> | 2014-07-04 16:14:48 +0200 |
commit | a63da4b5935bcb1e1fbba6f3156e7dfa60c90782 (patch) | |
tree | eedc1aa2adf63e552b693db07f4984ad144deae1 /src | |
parent | a391ad476392927c55dff6bb4b4b3e561b3b8047 (diff) | |
download | qtmultimedia-a63da4b5935bcb1e1fbba6f3156e7dfa60c90782.tar.gz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/alsa/qalsaaudiooutput.cpp | 30 | ||||
-rw-r--r-- | src/plugins/alsa/qalsaaudiooutput.h | 4 |
2 files changed, 1 insertions, 33 deletions
diff --git a/src/plugins/alsa/qalsaaudiooutput.cpp b/src/plugins/alsa/qalsaaudiooutput.cpp index 192b63596..c8d709cf9 100644 --- a/src/plugins/alsa/qalsaaudiooutput.cpp +++ b/src/plugins/alsa/qalsaaudiooutput.cpp @@ -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) { diff --git a/src/plugins/alsa/qalsaaudiooutput.h b/src/plugins/alsa/qalsaaudiooutput.h index 67976a55b..274878df3 100644 --- a/src/plugins/alsa/qalsaaudiooutput.h +++ b/src/plugins/alsa/qalsaaudiooutput.h @@ -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; |