Changeset 70639 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Jan 19, 2018 12:03:12 PM (7 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r70635 r70639 2213 2213 #endif 2214 2214 2215 int rc2 = CFGMR3QueryString(pCfgHandle, "DriverName", pThis->szName, sizeof(pThis->szName)); 2215 pThis->fTerminate = false; 2216 pThis->pCFGMNode = pCfgHandle; 2217 2218 int rc2 = CFGMR3QueryString(pThis->pCFGMNode, "DriverName", pThis->szName, sizeof(pThis->szName)); 2216 2219 if (RT_FAILURE(rc2)) 2217 2220 RTStrPrintf(pThis->szName, sizeof(pThis->szName), "Untitled"); 2218 2221 2219 2222 /* By default we don't enable anything if wrongly / not set-up. */ 2220 CFGMR3QueryBoolDef(p CfgHandle, "InputEnabled", &pThis->In.fEnabled, false);2221 CFGMR3QueryBoolDef(p CfgHandle, "OutputEnabled", &pThis->Out.fEnabled, false);2222 2223 CFGMR3QueryBoolDef(p CfgHandle, "DebugEnabled", &pThis->Dbg.fEnabled, false);2224 rc2 = CFGMR3QueryString(p CfgHandle, "DebugPathOut", pThis->Dbg.szPathOut, sizeof(pThis->Dbg.szPathOut));2223 CFGMR3QueryBoolDef(pThis->pCFGMNode, "InputEnabled", &pThis->In.fEnabled, false); 2224 CFGMR3QueryBoolDef(pThis->pCFGMNode, "OutputEnabled", &pThis->Out.fEnabled, false); 2225 2226 CFGMR3QueryBoolDef(pThis->pCFGMNode, "DebugEnabled", &pThis->Dbg.fEnabled, false); 2227 rc2 = CFGMR3QueryString(pThis->pCFGMNode, "DebugPathOut", pThis->Dbg.szPathOut, sizeof(pThis->Dbg.szPathOut)); 2225 2228 if ( RT_FAILURE(rc2) 2226 2229 || !strlen(pThis->Dbg.szPathOut)) … … 2235 2238 pThis->szName, pThis->In.fEnabled ? "enabled" : "disabled", pThis->Out.fEnabled ? "enabled" : "disabled")); 2236 2239 2237 /* 2238 * If everything went well, initialize the lower driver. 2239 */ 2240 rc = drvAudioHostInit(pThis, pCfgHandle); 2241 2242 LogFlowFuncLeaveRC(rc); 2240 LogFunc(("[%s] rc=%Rrc\n", pThis->szName, rc)); 2243 2241 return rc; 2244 2242 } … … 3199 3197 } 3200 3198 3199 /** 3200 * Does the actual backend driver attaching and queries the backend's interface. 3201 * 3202 * @return VBox status code. 3203 * @param pThis Pointer to driver instance. 3204 * @param fFlags Attach flags; see PDMDrvHlpAttach(). 3205 */ 3206 static int drvAudioDoAttachInternal(PDRVAUDIO pThis, uint32_t fFlags) 3207 { 3208 Assert(pThis->pHostDrvAudio == NULL); /* No nested attaching. */ 3209 3210 /* 3211 * Attach driver below and query its connector interface. 3212 */ 3213 PPDMIBASE pDownBase; 3214 int rc = PDMDrvHlpAttach(pThis->pDrvIns, fFlags, &pDownBase); 3215 if (RT_SUCCESS(rc)) 3216 { 3217 pThis->pHostDrvAudio = PDMIBASE_QUERY_INTERFACE(pDownBase, PDMIHOSTAUDIO); 3218 if (!pThis->pHostDrvAudio) 3219 { 3220 LogRel(("Audio: Failed to query interface for underlying host driver\n")); 3221 rc = PDMDRV_SET_ERROR(pThis->pDrvIns, VERR_PDM_MISSING_INTERFACE_BELOW, 3222 N_("Host audio backend missing or invalid")); 3223 } 3224 } 3225 3226 if (RT_SUCCESS(rc)) 3227 { 3228 /* 3229 * If everything went well, initialize the lower driver. 3230 */ 3231 AssertPtr(pThis->pCFGMNode); 3232 rc = drvAudioHostInit(pThis, pThis->pCFGMNode); 3233 } 3234 3235 LogFunc(("[%s] rc=%Rrc\n", pThis->szName, rc)); 3236 return rc; 3237 } 3238 3239 3201 3240 /********************************************************************/ 3202 3241 … … 3227 3266 3228 3267 LogFlowFuncEnter(); 3268 3269 if (!pThis->pHostDrvAudio) /* If not lower driver is configured, bail out. */ 3270 return; 3229 3271 3230 3272 /* Just destroy the host stream on the backend side. … … 3295 3337 #endif 3296 3338 3297 /* 3298 * Attach driver below and query its connector interface. 3299 */ 3300 PPDMIBASE pDownBase; 3301 int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pDownBase); 3302 if (RT_FAILURE(rc)) 3303 { 3304 LogRel(("Audio: Failed to attach to driver %p below (flags=0x%x), rc=%Rrc\n", 3305 pDrvIns, fFlags, rc)); 3306 return rc; 3307 } 3308 3309 pThis->pHostDrvAudio = PDMIBASE_QUERY_INTERFACE(pDownBase, PDMIHOSTAUDIO); 3310 if (!pThis->pHostDrvAudio) 3311 { 3312 LogRel(("Audio: Failed to query interface for underlying host driver\n")); 3313 return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_BELOW, 3314 N_("Host audio backend missing or invalid")); 3315 } 3316 3317 rc = drvAudioInit(pDrvIns, pCfg); 3339 int rc = drvAudioInit(pDrvIns, pCfg); 3318 3340 if (RT_SUCCESS(rc)) 3319 3341 { 3320 pThis->fTerminate = false;3321 pThis->pDrvIns = pDrvIns;3322 3323 3342 #ifdef VBOX_WITH_STATISTICS 3324 3343 PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->Stats.TotalStreamsActive, "TotalStreamsActive", … … 3354 3373 } 3355 3374 3375 rc = drvAudioDoAttachInternal(pThis, fFlags); 3376 if (RT_FAILURE(rc)) 3377 { 3378 /* No lower attached driver (yet)? Not a failure, might get attached later at runtime, just skip. */ 3379 if (rc == VERR_PDM_NO_ATTACHED_DRIVER) 3380 rc = VINF_SUCCESS; 3381 } 3382 3356 3383 LogFlowFuncLeaveRC(rc); 3357 3384 return rc; … … 3497 3524 AssertRC(rc2); 3498 3525 3499 int rc = VINF_SUCCESS;3500 3501 3526 LogFunc(("%s\n", pThis->szName)); 3527 3528 int rc = drvAudioDoAttachInternal(pThis, fFlags); 3502 3529 3503 3530 rc2 = RTCritSectLeave(&pThis->CritSect); -
trunk/src/VBox/Devices/Audio/DrvAudio.h
r70013 r70639 93 93 /** Pointer to audio driver below us. */ 94 94 PPDMIHOSTAUDIO pHostDrvAudio; 95 /** Pointer to CFGM configuration node of this driver. */ 96 PCFGMNODE pCFGMNode; 95 97 /** List of host input/output audio streams. */ 96 98 RTLISTANCHOR lstHstStreams;
Note:
See TracChangeset
for help on using the changeset viewer.