Changeset 88561 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 16, 2021 11:39:41 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 143856
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DevHda.cpp
r88503 r88561 4472 4472 } 4473 4473 4474 4474 4475 /** 4475 4476 * @interface_method_impl{PDMDEVREG,pfnAttach} … … 4496 4497 return VINF_SUCCESS; 4497 4498 } 4499 4498 4500 4499 4501 /** … … 4527 4529 } 4528 4530 4531 4529 4532 /** 4530 4533 * Powers off the device. … … 4558 4561 } 4559 4562 4563 4564 # ifdef VBOX_WITH_AUDIO_HDA_ONETIME_INIT 4560 4565 /** 4561 4566 * Replaces a driver with a the NullAudio drivers. … … 4575 4580 return rc; 4576 4581 } 4582 # endif 4577 4583 4578 4584 … … 4905 4911 break; 4906 4912 } 4907 if (rc == VERR_AUDIO_BACKEND_INIT_FAILED) 4908 { 4909 hdaR3ReconfigLunWithNullAudio(pDevIns, pThis, pThisCC, iLun); /* Pretend attaching to the NULL audio backend will never fail. */ 4910 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding", 4911 N_("Host audio backend initialization has failed. Selecting the NULL audio backend with the consequence that no sound is audible")); 4912 } 4913 else 4914 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("LUN#%u: rc=%Rrc\n", iLun, rc), rc); 4913 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("LUN#%u: rc=%Rrc\n", iLun, rc), rc); 4915 4914 } 4916 4915 -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r88357 r88561 4113 4113 } 4114 4114 4115 4116 # ifdef VBOX_WITH_AUDIO_AC97_ONETIME_INIT 4115 4117 /** 4116 4118 * Replaces a driver with a the NullAudio drivers. … … 4129 4131 return rc; 4130 4132 } 4133 # endif 4134 4131 4135 4132 4136 /** … … 4311 4315 break; 4312 4316 } 4313 if (rc == VERR_AUDIO_BACKEND_INIT_FAILED) 4314 { 4315 ichac97R3ReconfigLunWithNullAudio(pDevIns, pThisCC, iLun); /* Pretend attaching to the NULL audio backend will never fail. */ 4316 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding", 4317 N_("Host audio backend initialization has failed. " 4318 "Selecting the NULL audio backend with the consequence that no sound is audible")); 4319 } 4320 else 4321 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("LUN#%u: rc=%Rrc\n", iLun, rc), rc); 4317 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("LUN#%u: rc=%Rrc\n", iLun, rc), rc); 4322 4318 } 4323 4319 -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r88356 r88561 2253 2253 } 2254 2254 2255 2256 #ifdef VBOX_WITH_AUDIO_SB16_ONETIME_INIT 2255 2257 /** 2256 2258 * Replaces a driver with a the NullAudio drivers. … … 2268 2270 return rc; 2269 2271 } 2272 #endif 2273 2270 2274 2271 2275 /** … … 2494 2498 break; 2495 2499 } 2496 if (rc == VERR_AUDIO_BACKEND_INIT_FAILED) 2497 { 2498 sb16ReconfigLunWithNullAudio(pThis, iLun); /* Pretend attaching to the NULL audio backend will never fail. */ 2499 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding", 2500 N_("Host audio backend initialization has failed. " 2501 "Selecting the NULL audio backend with the consequence that no sound is audible")); 2502 } 2503 else 2504 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("LUN#%u: rc=%Rrc\n", iLun, rc), rc); 2500 AssertLogRelMsgReturn(RT_SUCCESS(rc), ("LUN#%u: rc=%Rrc\n", iLun, rc), rc); 2505 2501 } 2506 2502 -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88559 r88561 2251 2251 /** 2252 2252 * Initializes the host backend and queries its initial configuration. 2253 * If the host backend fails, VERR_AUDIO_BACKEND_INIT_FAILED will be returned.2254 *2255 * Note: As this routine is called when attaching to the device LUN in the2256 * device emulation, we either check for success or VERR_AUDIO_BACKEND_INIT_FAILED.2257 * Everything else is considered as fatal and must be handled separately in2258 * the device emulation!2259 2253 * 2260 2254 * @returns VBox status code. … … 3030 3024 /* Retrieve host driver name for easier identification. */ 3031 3025 AssertPtr(pThis->pHostDrvAudio); 3032 PPDMDRVINS pDrvAudioInst = PDMIBASE_2_PDMDRV(pThis->pDrvIns->pDownBase);3033 3026 RTStrPrintf(pStreamEx->Core.szName, RT_ELEMENTS(pStreamEx->Core.szName), "[%s] %s", 3034 pDrvAudioInst && pDrvAudioInst->pReg && pDrvAudioInst->pReg->szName[0] 3035 ? pDrvAudioInst->pReg->szName : "none", 3036 pCfgHost->szName[0] != '\0' ? pCfgHost->szName : "<Untitled>"); 3027 pThis->BackendCfg.szName, pCfgHost->szName[0] != '\0' ? pCfgHost->szName : "<Untitled>"); 3037 3028 3038 3029 pStreamEx->Core.enmDir = pCfgHost->enmDir; … … 3756 3747 * 3757 3748 * @returns VBox status code. 3749 * @param pDrvIns The driver instance. 3758 3750 * @param pThis Pointer to driver instance. 3759 3751 * @param fFlags Attach flags; see PDMDrvHlpAttach(). 3760 3752 */ 3761 static int drvAudioDoAttachInternal(P DRVAUDIO pThis, uint32_t fFlags)3753 static int drvAudioDoAttachInternal(PPDMDRVINS pDrvIns, PDRVAUDIO pThis, uint32_t fFlags) 3762 3754 { 3763 3755 Assert(pThis->pHostDrvAudio == NULL); /* No nested attaching. */ … … 3767 3759 */ 3768 3760 PPDMIBASE pDownBase; 3769 int rc = PDMDrvHlpAttach(p This->pDrvIns, fFlags, &pDownBase);3761 int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pDownBase); 3770 3762 if (RT_SUCCESS(rc)) 3771 3763 { … … 3787 3779 } 3788 3780 } 3789 3790 /* 3791 * Do some status code simplification for beningn host driver init failures. 3792 * The device above us will then replace it will the Null driver. 3793 */ 3794 /** @todo Do the Null driver replacment here, then we don't have to duplicate 3795 * it in 3+ devices! */ 3796 if ( rc == VERR_MODULE_NOT_FOUND 3797 || rc == VERR_SYMBOL_NOT_FOUND 3798 || rc == VERR_FILE_NOT_FOUND 3799 || rc == VERR_PATH_NOT_FOUND) 3800 { 3801 LogRel(("Audio: %Rrc -> VERR_AUDIO_BACKEND_INIT_FAILED\n", rc)); 3802 rc = VERR_AUDIO_BACKEND_INIT_FAILED; 3781 /* 3782 * If the host driver below us failed to construct for some beningn reason, 3783 * we'll report it as a runtime error and replace it with the Null driver. 3784 * 3785 * Note! We do NOT change anything in PDM (or CFGM), so pDrvIns->pDownBase 3786 * will remain NULL in this case. 3787 */ 3788 else if ( rc == VERR_AUDIO_BACKEND_INIT_FAILED 3789 || rc == VERR_MODULE_NOT_FOUND 3790 || rc == VERR_SYMBOL_NOT_FOUND 3791 || rc == VERR_FILE_NOT_FOUND 3792 || rc == VERR_PATH_NOT_FOUND) 3793 { 3794 /* Complain: */ 3795 LogRel(("DrvAudio: Host audio driver '%s' init failed with %Rrc. Switching to the NULL driver for now.\n", 3796 pThis->szName, rc)); 3797 PDMDrvHlpVMSetRuntimeError(pDrvIns, 0 /*fFlags*/, "HostAudioNotResponding", 3798 N_("Host audio backend (%s) initialization has failed. Selecting the NULL audio backend with the consequence that no sound is audible"), 3799 pThis->szName); 3800 3801 /* Replace with null audio: */ 3802 pThis->pHostDrvAudio = (PPDMIHOSTAUDIO)&g_DrvHostAudioNull; 3803 RTStrCopy(pThis->szName, sizeof(pThis->szName), "NULL"); 3804 rc = drvAudioHostInit(pThis); 3805 AssertRC(rc); 3803 3806 } 3804 3807 … … 3823 3826 AssertRCReturn(rc, rc); 3824 3827 3825 rc = drvAudioDoAttachInternal(p This, fFlags);3828 rc = drvAudioDoAttachInternal(pDrvIns, pThis, fFlags); 3826 3829 3827 3830 RTCritSectLeave(&pThis->CritSect); … … 4178 4181 * Attach the host driver, if present. 4179 4182 */ 4180 rc = drvAudioDoAttachInternal(p This, fFlags);4183 rc = drvAudioDoAttachInternal(pDrvIns, pThis, fFlags); 4181 4184 if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 4182 4185 rc = VINF_SUCCESS; -
trunk/src/VBox/Devices/Audio/DrvHostAudioNull.cpp
r88534 r88561 22 22 * Header Files * 23 23 *********************************************************************************************************************************/ 24 #include <iprt/mem.h>25 24 #include <iprt/uuid.h> /* For PDMIBASE_2_PDMDRV. */ 26 25 … … 44 43 /** Pointer to a null audio stream. */ 45 44 typedef NULLAUDIOSTREAM *PNULLAUDIOSTREAM; 46 47 /**48 * NULL audio driver instance data.49 * @implements PDMIAUDIOCONNECTOR50 */51 typedef struct DRVHOSTNULLAUDIO52 {53 /** Pointer to the driver instance structure. */54 PPDMDRVINS pDrvIns;55 /** Pointer to host audio interface. */56 PDMIHOSTAUDIO IHostAudio;57 } DRVHOSTNULLAUDIO;58 /** Pointer to the instance data for a null audio host driver. */59 typedef DRVHOSTNULLAUDIO *PDRVHOSTNULLAUDIO;60 45 61 46 … … 237 222 238 223 /** 224 * This is used directly by DrvAudio when a backend fails to initialize in a 225 * non-fatal manner. 226 */ 227 DECL_HIDDEN_CONST(PDMIHOSTAUDIO) const g_DrvHostAudioNull = 228 { 229 /* .pfnGetConfig =*/ drvHostNullAudioHA_GetConfig, 230 /* .pfnGetDevices =*/ NULL, 231 /* .pfnGetStatus =*/ drvHostNullAudioHA_GetStatus, 232 /* .pfnStreamCreate =*/ drvHostNullAudioHA_StreamCreate, 233 /* .pfnStreamDestroy =*/ drvHostNullAudioHA_StreamDestroy, 234 /* .pfnStreamControl =*/ drvHostNullAudioHA_StreamControl, 235 /* .pfnStreamGetReadable =*/ drvHostNullAudioHA_StreamGetReadable, 236 /* .pfnStreamGetWritable =*/ drvHostNullAudioHA_StreamGetWritable, 237 /* .pfnStreamGetPending =*/ drvHostNullAudioHA_StreamGetPending, 238 /* .pfnStreamGetStatus =*/ drvHostNullAudioHA_StreamGetStatus, 239 /* .pfnStreamPlay =*/ drvHostNullAudioHA_StreamPlay, 240 /* .pfnStreamCapture =*/ drvHostNullAudioHA_StreamCapture, 241 }; 242 243 244 /** 239 245 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 240 246 */ … … 242 248 { 243 249 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 244 P DRVHOSTNULLAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTNULLAUDIO);250 PPDMIHOSTAUDIO pThis = PDMINS_2_DATA(pDrvIns, PPDMIHOSTAUDIO); 245 251 246 252 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); 247 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);253 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, pThis); 248 254 return NULL; 249 255 } … … 258 264 { 259 265 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 260 P DRVHOSTNULLAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTNULLAUDIO);266 PPDMIHOSTAUDIO pThis = PDMINS_2_DATA(pDrvIns, PPDMIHOSTAUDIO); 261 267 RT_NOREF(pCfg, fFlags); 262 268 LogRel(("Audio: Initializing NULL driver\n")); … … 265 271 * Init the static parts. 266 272 */ 267 pThis->pDrvIns = pDrvIns;268 273 /* IBase */ 269 274 pDrvIns->IBase.pfnQueryInterface = drvHostNullAudioQueryInterface; 270 275 /* IHostAudio */ 271 pThis->IHostAudio.pfnGetConfig = drvHostNullAudioHA_GetConfig; 272 pThis->IHostAudio.pfnGetDevices = NULL; 273 pThis->IHostAudio.pfnGetStatus = drvHostNullAudioHA_GetStatus; 274 pThis->IHostAudio.pfnStreamCreate = drvHostNullAudioHA_StreamCreate; 275 pThis->IHostAudio.pfnStreamDestroy = drvHostNullAudioHA_StreamDestroy; 276 pThis->IHostAudio.pfnStreamControl = drvHostNullAudioHA_StreamControl; 277 pThis->IHostAudio.pfnStreamGetReadable = drvHostNullAudioHA_StreamGetReadable; 278 pThis->IHostAudio.pfnStreamGetWritable = drvHostNullAudioHA_StreamGetWritable; 279 pThis->IHostAudio.pfnStreamGetPending = drvHostNullAudioHA_StreamGetPending; 280 pThis->IHostAudio.pfnStreamGetStatus = drvHostNullAudioHA_StreamGetStatus; 281 pThis->IHostAudio.pfnStreamPlay = drvHostNullAudioHA_StreamPlay; 282 pThis->IHostAudio.pfnStreamCapture = drvHostNullAudioHA_StreamCapture; 276 *pThis = g_DrvHostAudioNull; 283 277 284 278 return VINF_SUCCESS; … … 308 302 ~0U, 309 303 /* cbInstance */ 310 sizeof( DRVHOSTNULLAUDIO),304 sizeof(PDMIHOSTAUDIO), 311 305 /* pfnConstruct */ 312 306 drvHostNullAudioConstruct, -
trunk/src/VBox/Devices/build/VBoxDD.h
r88153 r88561 138 138 #endif 139 139 extern const PDMDRVREG g_DrvHostNullAudio; 140 extern DECL_HIDDEN_DATA(struct PDMIHOSTAUDIO) const g_DrvHostAudioNull; 140 141 #if defined(RT_OS_WINDOWS) 141 142 extern const PDMDRVREG g_DrvHostDSound;
Note:
See TracChangeset
for help on using the changeset viewer.