Changeset 88880 in vbox
- Timestamp:
- May 5, 2021 3:45:29 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144215
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevHda.cpp
r88849 r88880 4633 4633 4634 4634 4635 # ifdef VBOX_WITH_AUDIO_HDA_ONETIME_INIT4636 /**4637 * Replaces a driver with a the NullAudio drivers.4638 *4639 * @returns VBox status code.4640 * @param pDevIns The device instance.4641 * @param pThis The shared HDA device state.4642 * @param pThisCC The ring-3 HDA device state.4643 * @param iLun The logical unit which is being replaced.4644 */4645 static int hdaR3ReconfigLunWithNullAudio(PPDMDEVINS pDevIns, PHDASTATE pThis, PHDASTATER3 pThisCC, unsigned iLun)4646 {4647 int rc = PDMDevHlpDriverReconfigure2(pDevIns, iLun, "AUDIO", "NullAudio");4648 if (RT_SUCCESS(rc))4649 rc = hdaR3AttachInternal(pDevIns, pThis, pThisCC, iLun, 0 /* fFlags */, NULL /* ppDrv */);4650 LogFunc(("pThis=%p, iLun=%u, rc=%Rrc\n", pThis, iLun, rc));4651 return rc;4652 }4653 # endif4654 4655 4656 4635 /** 4657 4636 * @interface_method_impl{PDMDEVREG,pfnReset} … … 5091 5070 AssertRCReturn(rc, rc); 5092 5071 } 5093 5094 # ifdef VBOX_WITH_AUDIO_HDA_ONETIME_INIT5095 /*5096 * Initialize the driver chain.5097 */5098 PHDADRIVER pDrv;5099 RTListForEach(&pThisCC->lstDrv, pDrv, HDADRIVER, Node)5100 {5101 /*5102 * Only primary drivers are critical for the VM to run. Everything else5103 * might not worth showing an own error message box in the GUI.5104 */5105 if (!(pDrv->fFlags & PDMAUDIODRVFLAGS_PRIMARY))5106 continue;5107 5108 PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector;5109 AssertPtr(pCon);5110 5111 bool fValidLineIn = AudioMixerStreamIsValid(pDrv->LineIn.pMixStrm);5112 # ifdef VBOX_WITH_AUDIO_HDA_MIC_IN5113 bool fValidMicIn = AudioMixerStreamIsValid(pDrv->MicIn.pMixStrm);5114 # endif5115 bool fValidOut = AudioMixerStreamIsValid(pDrv->Front.pMixStrm);5116 # ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND5117 /** @todo Anything to do here? */5118 # endif5119 5120 if ( !fValidLineIn5121 # ifdef VBOX_WITH_AUDIO_HDA_MIC_IN5122 && !fValidMicIn5123 # endif5124 && !fValidOut)5125 {5126 LogRel(("HDA: Falling back to NULL backend (no sound audible)\n"));5127 hdaR3Reset(pDevIns);5128 hdaR3ReconfigLunWithNullAudio(pDevIns, pThis, pThisCC, pDrv->uLUN);5129 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",5130 N_("No audio devices could be opened. "5131 "Selecting the NULL audio backend with the consequence that no sound is audible"));5132 }5133 else5134 {5135 bool fWarn = false;5136 5137 PDMAUDIOBACKENDCFG BackendCfg;5138 int rc2 = pCon->pfnGetConfig(pCon, &BackendCfg);5139 if (RT_SUCCESS(rc2))5140 {5141 if (BackendCfg.cMaxStreamsIn)5142 {5143 # ifdef VBOX_WITH_AUDIO_HDA_MIC_IN5144 /* If the audio backend supports two or more input streams at once,5145 * warn if one of our two inputs (microphone-in and line-in) failed to initialize. */5146 if (BackendCfg.cMaxStreamsIn >= 2)5147 fWarn = !fValidLineIn || !fValidMicIn;5148 /* If the audio backend only supports one input stream at once (e.g. pure ALSA, and5149 * *not* ALSA via PulseAudio plugin!), only warn if both of our inputs failed to initialize.5150 * One of the two simply is not in use then. */5151 else if (BackendCfg.cMaxStreamsIn == 1)5152 fWarn = !fValidLineIn && !fValidMicIn;5153 /* Don't warn if our backend is not able of supporting any input streams at all. */5154 # else /* !VBOX_WITH_AUDIO_HDA_MIC_IN */5155 /* We only have line-in as input source. */5156 fWarn = !fValidLineIn;5157 # endif /* !VBOX_WITH_AUDIO_HDA_MIC_IN */5158 }5159 5160 if ( !fWarn5161 && BackendCfg.cMaxStreamsOut)5162 fWarn = !fValidOut;5163 }5164 else5165 {5166 LogRel(("HDA: Unable to retrieve audio backend configuration for LUN #%RU8, rc=%Rrc\n", pDrv->uLUN, rc2));5167 fWarn = true;5168 }5169 5170 if (fWarn)5171 {5172 char szMissingStreams[255];5173 size_t len = 0;5174 if (!fValidLineIn)5175 {5176 LogRel(("HDA: WARNING: Unable to open PCM line input for LUN #%RU8!\n", pDrv->uLUN));5177 len = RTStrPrintf(szMissingStreams, sizeof(szMissingStreams), "PCM Input");5178 }5179 # ifdef VBOX_WITH_AUDIO_HDA_MIC_IN5180 if (!fValidMicIn)5181 {5182 LogRel(("HDA: WARNING: Unable to open PCM microphone input for LUN #%RU8!\n", pDrv->uLUN));5183 len += RTStrPrintf(szMissingStreams + len,5184 sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");5185 }5186 # endif /* VBOX_WITH_AUDIO_HDA_MIC_IN */5187 if (!fValidOut)5188 {5189 LogRel(("HDA: WARNING: Unable to open PCM output for LUN #%RU8!\n", pDrv->uLUN));5190 len += RTStrPrintf(szMissingStreams + len,5191 sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");5192 }5193 5194 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",5195 N_("Some HDA audio streams (%s) could not be opened. "5196 "Guest applications generating audio output or depending on audio input may hang. "5197 "Make sure your host audio device is working properly. "5198 "Check the logfile for error messages of the audio subsystem"), szMissingStreams);5199 }5200 }5201 }5202 # endif /* VBOX_WITH_AUDIO_HDA_ONETIME_INIT */5203 5072 5204 5073 hdaR3Reset(pDevIns); -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r88849 r88880 4114 4114 4115 4115 4116 # ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT4117 /**4118 * Replaces a driver with a the NullAudio drivers.4119 *4120 * @returns VBox status code.4121 * @param pDevIns The device instance.4122 * @param pThisCC The ring-3 AC'97 device state.4123 * @param iLun The logical unit which is being replaced.4124 */4125 static int ichac97R3ReconfigLunWithNullAudio(PPDMDEVINS pDevIns, PAC97STATER3 pThisCC, unsigned iLun)4126 {4127 int rc = PDMDevHlpDriverReconfigure2(pDevIns, iLun, "AUDIO", "NullAudio");4128 if (RT_SUCCESS(rc))4129 rc = ichac97R3AttachInternal(pDevIns, pThisCC, iLun, 0 /* fFlags */, NULL /* ppDrv */);4130 LogFunc(("pThisCC=%p, iLun=%u, rc=%Rrc\n", pThisCC, iLun, rc));4131 return rc;4132 }4133 # endif4134 4135 4136 4116 /** 4137 4117 * @interface_method_impl{PDMDEVREG,pfnDestruct} … … 4370 4350 AssertRCReturn(rc, rc); 4371 4351 } 4372 4373 4374 # ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT4375 PAC97DRIVER pDrv;4376 RTListForEach(&pThisCC->lstDrv, pDrv, AC97DRIVER, Node)4377 {4378 /*4379 * Only primary drivers are critical for the VM to run. Everything else4380 * might not worth showing an own error message box in the GUI.4381 */4382 if (!(pDrv->fFlags & PDMAUDIODRVFLAGS_PRIMARY))4383 continue;4384 4385 PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector;4386 AssertPtr(pCon);4387 4388 bool fValidLineIn = AudioMixerStreamIsValid(pDrv->LineIn.pMixStrm);4389 bool fValidMicIn = AudioMixerStreamIsValid(pDrv->MicIn.pMixStrm);4390 bool fValidOut = AudioMixerStreamIsValid(pDrv->Out.pMixStrm);4391 4392 if ( !fValidLineIn4393 && !fValidMicIn4394 && !fValidOut)4395 {4396 LogRel(("AC97: Falling back to NULL backend (no sound audible)\n"));4397 ichac97R3Reset(pDevIns);4398 ichac97R3ReconfigLunWithNullAudio(pDevIns, pThisCC, pDrv->uLUN);4399 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",4400 N_("No audio devices could be opened. "4401 "Selecting the NULL audio backend with the consequence that no sound is audible"));4402 }4403 else4404 {4405 bool fWarn = false;4406 4407 PDMAUDIOBACKENDCFG backendCfg;4408 int rc2 = pCon->pfnGetConfig(pCon, &backendCfg);4409 if (RT_SUCCESS(rc2))4410 {4411 if (backendCfg.cMaxStreamsIn)4412 {4413 /* If the audio backend supports two or more input streams at once,4414 * warn if one of our two inputs (microphone-in and line-in) failed to initialize. */4415 if (backendCfg.cMaxStreamsIn >= 2)4416 fWarn = !fValidLineIn || !fValidMicIn;4417 /* If the audio backend only supports one input stream at once (e.g. pure ALSA, and4418 * *not* ALSA via PulseAudio plugin!), only warn if both of our inputs failed to initialize.4419 * One of the two simply is not in use then. */4420 else if (backendCfg.cMaxStreamsIn == 1)4421 fWarn = !fValidLineIn && !fValidMicIn;4422 /* Don't warn if our backend is not able of supporting any input streams at all. */4423 }4424 4425 if ( !fWarn4426 && backendCfg.cMaxStreamsOut)4427 {4428 fWarn = !fValidOut;4429 }4430 }4431 else4432 {4433 LogRel(("AC97: Unable to retrieve audio backend configuration for LUN #%RU8, rc=%Rrc\n", pDrv->uLUN, rc2));4434 fWarn = true;4435 }4436 4437 if (fWarn)4438 {4439 char szMissingStreams[255] = "";4440 size_t len = 0;4441 if (!fValidLineIn)4442 {4443 LogRel(("AC97: WARNING: Unable to open PCM line input for LUN #%RU8!\n", pDrv->uLUN));4444 len = RTStrPrintf(szMissingStreams, sizeof(szMissingStreams), "PCM Input");4445 }4446 if (!fValidMicIn)4447 {4448 LogRel(("AC97: WARNING: Unable to open PCM microphone input for LUN #%RU8!\n", pDrv->uLUN));4449 len += RTStrPrintf(szMissingStreams + len,4450 sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");4451 }4452 if (!fValidOut)4453 {4454 LogRel(("AC97: WARNING: Unable to open PCM output for LUN #%RU8!\n", pDrv->uLUN));4455 len += RTStrPrintf(szMissingStreams + len,4456 sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");4457 }4458 4459 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",4460 N_("Some AC'97 audio streams (%s) could not be opened. Guest applications generating audio "4461 "output or depending on audio input may hang. Make sure your host audio device "4462 "is working properly. Check the logfile for error messages of the audio "4463 "subsystem"), szMissingStreams);4464 }4465 }4466 }4467 # endif /* VBOX_WITH_AUDIO_AC97_ONETIME_INIT */4468 4352 4469 4353 ichac97R3Reset(pDevIns); -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r88854 r88880 2988 2988 2989 2989 2990 #ifdef VBOX_WITH_AUDIO_SB16_ONETIME_INIT2991 /**2992 * Replaces a driver with a the NullAudio drivers.2993 *2994 * @returns VBox status code.2995 * @param pThis Device instance.2996 * @param iLun The logical unit which is being replaced.2997 */2998 static int sb16ReconfigLunWithNullAudio(PSB16STATE pThis, unsigned iLun)2999 {3000 int rc = PDMDevHlpDriverReconfigure2(pThis->pDevInsR3, iLun, "AUDIO", "NullAudio");3001 if (RT_SUCCESS(rc))3002 rc = sb16AttachInternal(pThis, iLun, 0 /* fFlags */, NULL /* ppDrv */);3003 LogFunc(("pThis=%p, iLun=%u, rc=%Rrc\n", pThis, iLun, rc));3004 return rc;3005 }3006 #endif3007 3008 3009 2990 /** 3010 2991 * @interface_method_impl{PDMDEVREG,pfnReset} … … 3315 3296 3316 3297 sb16DspCmdResetLegacy(pThis); 3317 3318 #ifdef VBOX_WITH_AUDIO_SB16_ONETIME_INIT3319 PSB16DRIVER pDrv, pNext;3320 RTListForEachSafe(&pThis->lstDrv, pDrv, pNext, SB16DRIVER, Node)3321 {3322 /*3323 * Only primary drivers are critical for the VM to run. Everything else3324 * might not worth showing an own error message box in the GUI.3325 */3326 if (!(pDrv->fFlags & PDMAUDIODRVFLAGS_PRIMARY))3327 continue;3328 3329 PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector;3330 AssertPtr(pCon);3331 3332 /** @todo No input streams available for SB16 yet. */3333 if (!AudioMixerStreamIsValid(pDrv->Out.pMixStrm))3334 {3335 LogRel(("SB16: Falling back to NULL backend (no sound audible)\n"));3336 3337 sb16DspCmdResetLegacy(pThis);3338 sb16ReconfigLunWithNullAudio(pThis, pDrv->uLUN);3339 pDrv = NULL; /* no longer valid */3340 3341 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",3342 N_("No audio devices could be opened. "3343 "Selecting the NULL audio backend with the consequence that no sound is audible"));3344 }3345 }3346 #endif /* VBOX_WITH_AUDIO_SB16_ONETIME_INIT */3347 3298 3348 3299 /* -
trunk/src/VBox/Devices/Config.kmk
r88770 r88880 106 106 VBOX_AUDIO_DEFS += VBOX_WITH_AUDIO_CALLBACKS 107 107 108 # Disable one-time audio stream initialization at device creation (VM startup) instead109 # of creating the stream when needed at some later point in time.110 #111 # This was the default behavior ever since.112 #113 # We now go with the new behavior by default now.114 #VBOX_AUDIO_DEFS += VBOX_WITH_AUDIO_SB16_ONETIME_INIT115 116 108 ifdef VBOX_WITH_HP_HDA 117 109 VBOX_AUDIO_DEFS += VBOX_WITH_HP_HDA
Note:
See TracChangeset
for help on using the changeset viewer.