8157753: Audio replay enhancement

Reviewed-by: amenkov, prr, mschoene
This commit is contained in:
Sergey Bylokhov 2016-06-28 19:48:05 +03:00
parent b40f7ccf8e
commit 8fbf862835
5 changed files with 20 additions and 2 deletions

View File

@ -817,6 +817,10 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
ERROR1("<<DAUDIO_Open: ERROR: unsupported encoding (%d)\n", encoding);
return NULL;
}
if (channels <= 0) {
ERROR1("<<DAUDIO_Open: ERROR: Invalid number of channels=%d!\n", channels);
return NULL;
}
OSX_DirectAudioDevice *device = new OSX_DirectAudioDevice();

View File

@ -434,7 +434,10 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
snd_output_stdio_attach(&ALSA_OUTPUT, stdout, 0);
}
#endif
if (channels <= 0) {
ERROR1("ERROR: Invalid number of channels=%d!\n", channels);
return NULL;
}
info = (AlsaPcmInfo*) malloc(sizeof(AlsaPcmInfo));
if (!info) {
ERROR0("Out of memory\n");

View File

@ -434,7 +434,10 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
snd_output_stdio_attach(&ALSA_OUTPUT, stdout, 0);
}
#endif
if (channels <= 0) {
ERROR1("ERROR: Invalid number of channels=%d!\n", channels);
return NULL;
}
info = (AlsaPcmInfo*) malloc(sizeof(AlsaPcmInfo));
if (!info) {
ERROR0("Out of memory\n");

View File

@ -182,6 +182,10 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
ERROR1(" DAUDIO_Open: invalid encoding %d\n", (int) encoding);
return NULL;
}
if (channels <= 0) {
ERROR1(" DAUDIO_Open: Invalid number of channels=%d!\n", channels);
return NULL;
}
info = (SolPcmInfo*) malloc(sizeof(SolPcmInfo));
if (!info) {

View File

@ -859,6 +859,10 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
ERROR1("DAUDIO_Open: ERROR: cannot open the device with encoding=%d!\n", encoding);
return NULL;
}
if (channels <= 0) {
ERROR1("DAUDIO_Open: ERROR: Invalid number of channels=%d!\n", channels);
return NULL;
}
if (sampleSizeInBits > 8 &&
#ifdef _LITTLE_ENDIAN
isBigEndian