Disable Alsa Test with -w alsa-no-test

This commit is contained in:
jojo61 2023-07-16 10:07:21 +02:00
parent f72653c3c1
commit 1390139cbd
3 changed files with 133 additions and 127 deletions

253
audio.c
View File

@ -93,6 +93,7 @@ static const AudioModule NoopModule; ///< forward definition of noop module
// Variables // Variables
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
char AudioAlsaNotest; ///< disable Audio capbility test
char AudioAlsaDriverBroken; ///< disable broken driver message char AudioAlsaDriverBroken; ///< disable broken driver message
char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
@ -2187,143 +2188,145 @@ found:
AudioRingInit(); AudioRingInit();
AudioUsedModule->Init(); AudioUsedModule->Init();
#if 0 if (AudioAlsaNotest) {
for (u = 0; u < AudioRatesMax; ++u) { for (u = 0; u < AudioRatesMax; ++u) {
AudioChannelMatrix[u][1]=AudioChannelMatrix[u][2]=AudioChannelMatrix[u][3]=AudioChannelMatrix[u][4]=\ AudioChannelMatrix[u][1]=AudioChannelMatrix[u][2]=2;
AudioChannelMatrix[u][5]=AudioChannelMatrix[u][6]=AudioChannelMatrix[u][7]=AudioChannelMatrix[u][8]=2; AudioChannelMatrix[u][3]=AudioChannelMatrix[u][4]=4;
printf("audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u], AudioChannelMatrix[u][5]=AudioChannelMatrix[u][6]=6;
AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4], AudioChannelMatrix[u][7]=AudioChannelMatrix[u][8]=8;
AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]); printf("audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
}
AudioChannelsInHw[1]=AudioChannelsInHw[3]=AudioChannelsInHw[4]=AudioChannelsInHw[5]=AudioChannelsInHw[6]=AudioChannelsInHw[7]=AudioChannelsInHw[8]=0;
AudioChannelsInHw[2]=2;
} }
else {
AudioChannelsInHw[1]=AudioChannelsInHw[3]=AudioChannelsInHw[4]=AudioChannelsInHw[5]=AudioChannelsInHw[6]=AudioChannelsInHw[7]=AudioChannelsInHw[8]=0; //
AudioChannelsInHw[2]=2; // Check which channels/rates/formats are supported
// FIXME: we force 44.1Khz and 48Khz must be supported equal
#else // FIXME: should use bitmap of channels supported in RatesInHw
// // FIXME: use loop over sample-rates
// Check which channels/rates/formats are supported freq = 44100;
// FIXME: we force 44.1Khz and 48Khz must be supported equal AudioRatesInHw[Audio44100] = 0;
// FIXME: should use bitmap of channels supported in RatesInHw
// FIXME: use loop over sample-rates
freq = 44100;
AudioRatesInHw[Audio44100] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio44100] |= (1 << chan);
}
}
freq = 48000;
AudioRatesInHw[Audio48000] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
if (!AudioChannelsInHw[chan]) {
continue;
}
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio48000] |= (1 << chan);
}
}
freq = 192000;
AudioRatesInHw[Audio192000] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
if (!AudioChannelsInHw[chan]) {
continue;
}
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio192000] |= (1 << chan);
}
}
// build channel support and conversion table
for (u = 0; u < AudioRatesMax; ++u) {
for (chan = 1; chan < 9; ++chan) { for (chan = 1; chan < 9; ++chan) {
AudioChannelMatrix[u][chan] = 0; int tchan;
if (!AudioRatesInHw[u]) { // rate unsupported int tfreq;
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio44100] |= (1 << chan);
}
}
freq = 48000;
AudioRatesInHw[Audio48000] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
if (!AudioChannelsInHw[chan]) {
continue; continue;
} }
if (AudioChannelsInHw[chan]) { tchan = chan;
AudioChannelMatrix[u][chan] = chan; tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else { } else {
switch (chan) { AudioChannelsInHw[chan] = chan;
case 1: AudioRatesInHw[Audio48000] |= (1 << chan);
if (AudioChannelsInHw[2]) { }
AudioChannelMatrix[u][chan] = 2; }
} freq = 192000;
break; AudioRatesInHw[Audio192000] = 0;
case 2: for (chan = 1; chan < 9; ++chan) {
case 3: int tchan;
if (AudioChannelsInHw[4]) { int tfreq;
AudioChannelMatrix[u][chan] = 4;
if (!AudioChannelsInHw[chan]) {
continue;
}
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio192000] |= (1 << chan);
}
}
// build channel support and conversion table
for (u = 0; u < AudioRatesMax; ++u) {
for (chan = 1; chan < 9; ++chan) {
AudioChannelMatrix[u][chan] = 0;
if (!AudioRatesInHw[u]) { // rate unsupported
continue;
}
if (AudioChannelsInHw[chan]) {
AudioChannelMatrix[u][chan] = chan;
} else {
switch (chan) {
case 1:
if (AudioChannelsInHw[2]) {
AudioChannelMatrix[u][chan] = 2;
}
break; break;
} case 2:
case 4: case 3:
if (AudioChannelsInHw[5]) { if (AudioChannelsInHw[4]) {
AudioChannelMatrix[u][chan] = 5; AudioChannelMatrix[u][chan] = 4;
break;
}
case 4:
if (AudioChannelsInHw[5]) {
AudioChannelMatrix[u][chan] = 5;
break;
}
case 5:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
case 6:
if (AudioChannelsInHw[7]) {
AudioChannelMatrix[u][chan] = 7;
break;
}
case 7:
if (AudioChannelsInHw[8]) {
AudioChannelMatrix[u][chan] = 8;
break;
}
case 8:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
if (AudioChannelsInHw[2]) {
AudioChannelMatrix[u][chan] = 2;
break;
}
if (AudioChannelsInHw[1]) {
AudioChannelMatrix[u][chan] = 1;
break;
}
break; break;
} }
case 5:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
case 6:
if (AudioChannelsInHw[7]) {
AudioChannelMatrix[u][chan] = 7;
break;
}
case 7:
if (AudioChannelsInHw[8]) {
AudioChannelMatrix[u][chan] = 8;
break;
}
case 8:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
if (AudioChannelsInHw[2]) {
AudioChannelMatrix[u][chan] = 2;
break;
}
if (AudioChannelsInHw[1]) {
AudioChannelMatrix[u][chan] = 1;
break;
}
break;
} }
} }
} }
for (u = 0; u < AudioRatesMax; ++u) {
Debug(3,"audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
}
} }
for (u = 0; u < AudioRatesMax; ++u) {
Debug(3,"audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
}
#endif
#ifdef USE_AUDIO_THREAD #ifdef USE_AUDIO_THREAD
if (AudioUsedModule->Thread) { // supports threads if (AudioUsedModule->Thread) { // supports threads
AudioInitThread(); AudioInitThread();

View File

@ -60,6 +60,7 @@ extern void AudioExit(void); ///< cleanup and exit audio module
// Variables // Variables
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
extern char AudioAlsaNotest; ///< disable Alsa capability test
extern char AudioAlsaDriverBroken; ///< disable broken driver message extern char AudioAlsaDriverBroken; ///< disable broken driver message
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix

View File

@ -2817,8 +2817,8 @@ const char *CommandLineHelp(void) {
"\tstill-h264-hw-decoder\tenable h264 hw decoder for still-pictures\n" "\tstill-h264-hw-decoder\tenable h264 hw decoder for still-pictures\n"
"\talsa-driver-broken\tdisable broken alsa driver message\n" "\talsa-driver-broken\tdisable broken alsa driver message\n"
"\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n" "\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n"
"\talsa-close-open-delay\tenable close open delay to fix no sound " "\talsa-no-test\tdisable Alsa Capability test on start for NUC11/12\n"
"bug\n" "\talsa-close-open-delay\tenable close open delay to fix no sound bug\n"
"\tignore-repeat-pict\tdisable repeat pict message\n" "\tignore-repeat-pict\tdisable repeat pict message\n"
"\tuse-possible-defect-frames prefer faster channel switch\n" "\tuse-possible-defect-frames prefer faster channel switch\n"
" -D\t\tstart in detached mode\n"; " -D\t\tstart in detached mode\n";
@ -2908,6 +2908,8 @@ int ProcessArgs(int argc, char *const argv[]) {
AudioAlsaDriverBroken = 1; AudioAlsaDriverBroken = 1;
} else if (!strcasecmp("alsa-no-close-open", optarg)) { } else if (!strcasecmp("alsa-no-close-open", optarg)) {
AudioAlsaNoCloseOpen = 1; AudioAlsaNoCloseOpen = 1;
} else if (!strcasecmp("alsa-no-test", optarg)) {
AudioAlsaNotest = 1;
} else if (!strcasecmp("alsa-close-open-delay", optarg)) { } else if (!strcasecmp("alsa-close-open-delay", optarg)) {
AudioAlsaCloseOpenDelay = 1; AudioAlsaCloseOpenDelay = 1;
} else if (!strcasecmp("ignore-repeat-pict", optarg)) { } else if (!strcasecmp("ignore-repeat-pict", optarg)) {