summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Nolden <nolden@kde.org>2016-06-27 10:57:05 +0200
committerRalf Nolden <nolden@kde.org>2016-06-29 09:55:13 +0000
commitbc53bb7913bbf68519508a0ab76c513335b3e5bb (patch)
tree1bffc021cd6072bf20764cb4ddfefbc684367bf8
parent970128036ab6850ba292465806afe5b799851ac1 (diff)
Fix use of -ESTRPIPE where it's not available in errno
NetBSD does not have -ESTRPIPE, so use it only when defined. http://netbsd.gw.com/cgi-bin/man-cgi?errno+2+NetBSD-6.0 and https://mail-index.netbsd.org/pkgsrc-wip-discuss/2013/10/27/msg002529.html Change-Id: I92921a16fcae95f58a870aea98ca66f5a5d30a12 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rw-r--r--src/plugins/alsa/qalsaaudioinput.cpp11
-rw-r--r--src/plugins/alsa/qalsaaudiooutput.cpp8
2 files changed, 16 insertions, 3 deletions
diff --git a/src/plugins/alsa/qalsaaudioinput.cpp b/src/plugins/alsa/qalsaaudioinput.cpp
index 2d636d1e5..599e10177 100644
--- a/src/plugins/alsa/qalsaaudioinput.cpp
+++ b/src/plugins/alsa/qalsaaudioinput.cpp
@@ -121,6 +121,12 @@ int QAlsaAudioInput::xrun_recovery(int err)
int count = 0;
bool reset = false;
+ // ESTRPIPE is not available in all OSes where ALSA is available
+ int estrpipe = EIO;
+#ifdef ESTRPIPE
+ estrpipe = ESTRPIPE;
+#endif
+
if(err == -EPIPE) {
errorState = QAudio::UnderrunError;
err = snd_pcm_prepare(handle);
@@ -131,8 +137,7 @@ int QAlsaAudioInput::xrun_recovery(int err)
if (bytesAvailable <= 0)
reset = true;
}
-
- } else if((err == -ESTRPIPE)||(err == -EIO)) {
+ } else if ((err == -estrpipe)||(err == -EIO)) {
errorState = QAudio::IOError;
while((err = snd_pcm_resume(handle)) == -EAGAIN){
usleep(100);
@@ -541,8 +546,10 @@ qint64 QAlsaAudioInput::read(char* data, qint64 len)
if(readFrames == -EPIPE) {
errorState = QAudio::UnderrunError;
err = snd_pcm_prepare(handle);
+#ifdef ESTRPIPE
} else if(readFrames == -ESTRPIPE) {
err = snd_pcm_prepare(handle);
+#endif
}
if(err != 0) break;
}
diff --git a/src/plugins/alsa/qalsaaudiooutput.cpp b/src/plugins/alsa/qalsaaudiooutput.cpp
index bf607e057..57937135d 100644
--- a/src/plugins/alsa/qalsaaudiooutput.cpp
+++ b/src/plugins/alsa/qalsaaudiooutput.cpp
@@ -114,6 +114,12 @@ int QAlsaAudioOutput::xrun_recovery(int err)
int count = 0;
bool reset = false;
+ // ESTRPIPE is not available in all OSes where ALSA is available
+ int estrpipe = EIO;
+#ifdef ESTRPIPE
+ estrpipe = ESTRPIPE;
+#endif
+
if(err == -EPIPE) {
errorState = QAudio::UnderrunError;
emit errorChanged(errorState);
@@ -121,7 +127,7 @@ int QAlsaAudioOutput::xrun_recovery(int err)
if(err < 0)
reset = true;
- } else if((err == -ESTRPIPE)||(err == -EIO)) {
+ } else if ((err == -estrpipe)||(err == -EIO)) {
errorState = QAudio::IOError;
emit errorChanged(errorState);
while((err = snd_pcm_resume(handle)) == -EAGAIN){