[channel,tsmf] fix issue with oss backend

This commit is contained in:
akallabeth 2024-02-12 08:36:05 +01:00 committed by akallabeth
parent 34d5462111
commit 94a29e7b2c
1 changed files with 31 additions and 31 deletions

View File

@ -58,40 +58,40 @@ typedef struct
UINT32 data_size_last;
} TSMFOssAudioDevice;
#define OSS_LOG_ERR(_text, _error) \
do \
{ \
if (_error != 0) \
{ \
char ebuffer[256] = { 0 };
WLog_ERR(TAG, "%s: %i - %s", _text, _error, winpr_strerror(_error, ebuffer, sizeof(ebuffer)));
}
}
while (0)
#define OSS_LOG_ERR(_text, _error) \
do \
{ \
if ((_error) != 0) \
{ \
char ebuffer[256] = { 0 }; \
WLog_ERR(TAG, "%s: %i - %s", (_text), (_error), \
winpr_strerror((_error), ebuffer, sizeof(ebuffer))); \
} \
} while (0)
static BOOL tsmf_oss_open(ITSMFAudioDevice* audio, const char* device)
static BOOL tsmf_oss_open(ITSMFAudioDevice* audio, const char* device)
{
int tmp;
TSMFOssAudioDevice* oss = (TSMFOssAudioDevice*)audio;
if (oss == NULL || oss->pcm_handle != -1)
return FALSE;
if (device == NULL) /* Default device. */
{
int tmp;
TSMFOssAudioDevice* oss = (TSMFOssAudioDevice*)audio;
strncpy(oss->dev_name, "/dev/dsp", sizeof(oss->dev_name));
}
else
{
strncpy(oss->dev_name, device, sizeof(oss->dev_name) - 1);
}
if (oss == NULL || oss->pcm_handle != -1)
return FALSE;
if (device == NULL) /* Default device. */
{
strncpy(oss->dev_name, "/dev/dsp", sizeof(oss->dev_name));
}
else
{
strncpy(oss->dev_name, device, sizeof(oss->dev_name) - 1);
}
if ((oss->pcm_handle = open(oss->dev_name, O_WRONLY)) < 0)
{
OSS_LOG_ERR("sound dev open failed", errno);
oss->pcm_handle = -1;
return FALSE;
}
if ((oss->pcm_handle = open(oss->dev_name, O_WRONLY)) < 0)
{
OSS_LOG_ERR("sound dev open failed", errno);
oss->pcm_handle = -1;
return FALSE;
}
#if 0 /* FreeBSD OSS implementation at this moment (2015.03) does not set PCM_CAP_OUTPUT flag. */
tmp = 0;