mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
OSS: Remove some redundant device status checks.
This commit is contained in:
-14
@@ -39755,18 +39755,11 @@ static ma_result ma_device_write__oss(ma_device* pDevice, const void* pPCMFrames
|
||||
{
|
||||
ma_device_state_oss* pDeviceStateOSS = ma_device_get_backend_state__oss(pDevice);
|
||||
int resultOSS;
|
||||
ma_uint32 deviceState;
|
||||
|
||||
if (pFramesWritten != NULL) {
|
||||
*pFramesWritten = 0;
|
||||
}
|
||||
|
||||
/* Don't do any processing if the device is stopped. */
|
||||
deviceState = ma_device_get_status(pDevice);
|
||||
if (deviceState != ma_device_status_started && deviceState != ma_device_status_starting) {
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
resultOSS = write(pDeviceStateOSS->fdPlayback, pPCMFrames, frameCount * ma_get_bytes_per_frame(pDevice->playback.internalFormat, pDevice->playback.internalChannels));
|
||||
if (resultOSS < 0) {
|
||||
ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[OSS] Failed to send data from the client to the device.");
|
||||
@@ -39784,18 +39777,11 @@ static ma_result ma_device_read__oss(ma_device* pDevice, void* pPCMFrames, ma_ui
|
||||
{
|
||||
ma_device_state_oss* pDeviceStateOSS = ma_device_get_backend_state__oss(pDevice);
|
||||
int resultOSS;
|
||||
ma_uint32 deviceState;
|
||||
|
||||
if (pFramesRead != NULL) {
|
||||
*pFramesRead = 0;
|
||||
}
|
||||
|
||||
/* Don't do any processing if the device is stopped. */
|
||||
deviceState = ma_device_get_status(pDevice);
|
||||
if (deviceState != ma_device_status_started && deviceState != ma_device_status_starting) {
|
||||
return MA_SUCCESS;
|
||||
}
|
||||
|
||||
resultOSS = read(pDeviceStateOSS->fdCapture, pPCMFrames, frameCount * ma_get_bytes_per_frame(pDevice->capture.internalFormat, pDevice->capture.internalChannels));
|
||||
if (resultOSS < 0) {
|
||||
ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[OSS] Failed to read data from the device to be sent to the client.");
|
||||
|
||||
Reference in New Issue
Block a user