VirtualBox

Changeset 88880 in vbox


Ignore:
Timestamp:
May 5, 2021 3:45:29 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144215
Message:

Audio: Removed the obsolete VBOX_WITH_AUDIO_XXX_ONETIME_INIT code. bugref:9890

Location:
trunk/src/VBox/Devices
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevHda.cpp

    r88849 r88880  
    46334633
    46344634
    4635 # ifdef VBOX_WITH_AUDIO_HDA_ONETIME_INIT
    4636 /**
    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 # endif
    4654 
    4655 
    46564635/**
    46574636 * @interface_method_impl{PDMDEVREG,pfnReset}
     
    50915070        AssertRCReturn(rc, rc);
    50925071    }
    5093 
    5094 # ifdef VBOX_WITH_AUDIO_HDA_ONETIME_INIT
    5095     /*
    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 else
    5103          * 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_IN
    5113         bool fValidMicIn  = AudioMixerStreamIsValid(pDrv->MicIn.pMixStrm);
    5114 #  endif
    5115         bool fValidOut    = AudioMixerStreamIsValid(pDrv->Front.pMixStrm);
    5116 #  ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
    5117         /** @todo Anything to do here? */
    5118 #  endif
    5119 
    5120         if (    !fValidLineIn
    5121 #  ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
    5122              && !fValidMicIn
    5123 #  endif
    5124              && !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         else
    5134         {
    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_IN
    5144                     /* 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, and
    5149                      * *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 (   !fWarn
    5161                     && BackendCfg.cMaxStreamsOut)
    5162                     fWarn = !fValidOut;
    5163             }
    5164             else
    5165             {
    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_IN
    5180                 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 */
    52035072
    52045073    hdaR3Reset(pDevIns);
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r88849 r88880  
    41144114
    41154115
    4116 # ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT
    4117 /**
    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 # endif
    4134 
    4135 
    41364116/**
    41374117 * @interface_method_impl{PDMDEVREG,pfnDestruct}
     
    43704350        AssertRCReturn(rc, rc);
    43714351    }
    4372 
    4373 
    4374 # ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT
    4375     PAC97DRIVER pDrv;
    4376     RTListForEach(&pThisCC->lstDrv, pDrv, AC97DRIVER, Node)
    4377     {
    4378         /*
    4379          * Only primary drivers are critical for the VM to run. Everything else
    4380          * 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 (    !fValidLineIn
    4393              && !fValidMicIn
    4394              && !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         else
    4404         {
    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, and
    4418                      * *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 (   !fWarn
    4426                     && backendCfg.cMaxStreamsOut)
    4427                 {
    4428                     fWarn = !fValidOut;
    4429                 }
    4430             }
    4431             else
    4432             {
    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 */
    44684352
    44694353    ichac97R3Reset(pDevIns);
  • trunk/src/VBox/Devices/Audio/DevSB16.cpp

    r88854 r88880  
    29882988
    29892989
    2990 #ifdef VBOX_WITH_AUDIO_SB16_ONETIME_INIT
    2991 /**
    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 #endif
    3007 
    3008 
    30092990/**
    30102991 * @interface_method_impl{PDMDEVREG,pfnReset}
     
    33153296
    33163297    sb16DspCmdResetLegacy(pThis);
    3317 
    3318 #ifdef VBOX_WITH_AUDIO_SB16_ONETIME_INIT
    3319     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 else
    3324          * 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 */
    33473298
    33483299    /*
  • trunk/src/VBox/Devices/Config.kmk

    r88770 r88880  
    106106VBOX_AUDIO_DEFS += VBOX_WITH_AUDIO_CALLBACKS
    107107
    108 # Disable one-time audio stream initialization at device creation (VM startup) instead
    109 # 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_INIT
    115 
    116108ifdef VBOX_WITH_HP_HDA
    117109 VBOX_AUDIO_DEFS += VBOX_WITH_HP_HDA
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette