mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
ALSA: Fix some warnings relating to unhandled return value of read().
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
v0.11.22 - TBD
|
v0.11.22 - TBD
|
||||||
=====================
|
=====================
|
||||||
|
* ALSA: Fix some warnings relating to unhandled return value of `read()`.
|
||||||
* DirectSound: Add support for specifying an explicit window handle for SetCooperativeLevel().
|
* DirectSound: Add support for specifying an explicit window handle for SetCooperativeLevel().
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+18
-11
@@ -28073,6 +28073,7 @@ static ma_result ma_device_stop__alsa(ma_device* pDevice)
|
|||||||
a small chance that our wakeupfd has not been cleared. We'll clear that out now if applicable.
|
a small chance that our wakeupfd has not been cleared. We'll clear that out now if applicable.
|
||||||
*/
|
*/
|
||||||
int resultPoll;
|
int resultPoll;
|
||||||
|
int resultRead;
|
||||||
|
|
||||||
if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
|
if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
|
||||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[ALSA] Dropping capture device...\n");
|
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[ALSA] Dropping capture device...\n");
|
||||||
@@ -28087,12 +28088,15 @@ static ma_result ma_device_stop__alsa(ma_device* pDevice)
|
|||||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[ALSA] Preparing capture device successful.\n");
|
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[ALSA] Preparing capture device successful.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the wakeupfd. */
|
/* Clear the wakeupfd. */
|
||||||
resultPoll = poll((struct pollfd*)pDevice->alsa.pPollDescriptorsCapture, 1, 0);
|
resultPoll = poll((struct pollfd*)pDevice->alsa.pPollDescriptorsCapture, 1, 0);
|
||||||
if (resultPoll > 0) {
|
if (resultPoll > 0) {
|
||||||
ma_uint64 t;
|
ma_uint64 t;
|
||||||
read(((struct pollfd*)pDevice->alsa.pPollDescriptorsCapture)[0].fd, &t, sizeof(t));
|
resultRead = read(((struct pollfd*)pDevice->alsa.pPollDescriptorsCapture)[0].fd, &t, sizeof(t));
|
||||||
}
|
if (resultRead != sizeof(t)) {
|
||||||
|
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[ALSA] Failed to read from capture wakeupfd. read() = %d\n", resultRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
|
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
|
||||||
@@ -28109,11 +28113,14 @@ static ma_result ma_device_stop__alsa(ma_device* pDevice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the wakeupfd. */
|
/* Clear the wakeupfd. */
|
||||||
resultPoll = poll((struct pollfd*)pDevice->alsa.pPollDescriptorsPlayback, 1, 0);
|
resultPoll = poll((struct pollfd*)pDevice->alsa.pPollDescriptorsPlayback, 1, 0);
|
||||||
if (resultPoll > 0) {
|
if (resultPoll > 0) {
|
||||||
ma_uint64 t;
|
ma_uint64 t;
|
||||||
read(((struct pollfd*)pDevice->alsa.pPollDescriptorsPlayback)[0].fd, &t, sizeof(t));
|
resultRead = read(((struct pollfd*)pDevice->alsa.pPollDescriptorsPlayback)[0].fd, &t, sizeof(t));
|
||||||
}
|
if (resultRead != sizeof(t)) {
|
||||||
|
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_DEBUG, "[ALSA] Failed to read from playback wakeupfd. read() = %d\n", resultRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user