Changeset 89220 in vbox
- Timestamp:
- May 21, 2021 12:16:52 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144562
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp
r89213 r89220 167 167 PCOREAUDIOBUF paBuffers; 168 168 169 /** The audio unit for this stream. */170 struct171 {172 /** Pointer to the device this audio unit is bound to.173 * Can be NULL if not bound to a device (anymore). */174 PCOREAUDIODEVICEDATA pDevice;175 #if 0 /* not used */176 /** The actual audio unit object. */177 AudioUnit hAudioUnit;178 /** Stream description for using with VBox:179 * - When using this audio unit for input (capturing), this format states180 * the unit's output format.181 * - When using this audio unit for output (playback), this format states182 * the unit's input format. */183 AudioStreamBasicDescription StreamFmt;184 #endif185 } Unit;186 169 /** Initialization status tracker, actually COREAUDIOINITSTATE. 187 170 * Used when some of the device parameters or the device itself is changed … … 1459 1442 * Do we have a device for the requested stream direction? 1460 1443 */ 1461 PCOREAUDIODEVICEDATA pDev = pCfgReq->enmDir == PDMAUDIODIR_IN ? pThis->pDefaultDevIn : pThis->pDefaultDevOut; 1444 RTCritSectEnter(&pThis->CritSect); 1445 CFStringRef hDevUidStr = NULL; 1446 { 1447 PCOREAUDIODEVICEDATA pDev = pCfgReq->enmDir == PDMAUDIODIR_IN ? pThis->pDefaultDevIn : pThis->pDefaultDevOut; 1448 if (pDev) 1449 { 1450 Assert(pDev->Core.cbSelf == sizeof(*pDev)); 1451 hDevUidStr = pDev->UUID; 1452 CFRetain(pDev->UUID); 1453 } 1454 } 1455 RTCritSectLeave(&pThis->CritSect); 1456 1462 1457 #ifdef LOG_ENABLED 1463 1458 char szTmp[PDMAUDIOSTRMCFGTOSTRING_MAX]; 1464 1459 #endif 1465 LogFunc(("pDev=%p *pCfgReq: %s\n", pDev, PDMAudioStrmCfgToString(pCfgReq, szTmp, sizeof(szTmp)) )); 1466 if (pDev) 1467 { 1468 Assert(pDev->Core.cbSelf == sizeof(*pDev)); 1469 1460 LogFunc(("hDevUidStr=%p *pCfgReq: %s\n", hDevUidStr, PDMAudioStrmCfgToString(pCfgReq, szTmp, sizeof(szTmp)) )); 1461 if (hDevUidStr) 1462 { 1470 1463 /* 1471 1464 * Basic structure init. … … 1477 1470 pStreamCA->offInternal = 0; 1478 1471 pStreamCA->idxBuffer = 0; 1479 pStreamCA->Unit.pDevice = pDev; /** @todo r=bird: How do we protect this against enumeration releasing pDefaultDevOut/In. */1480 1472 pStreamCA->enmInitState = COREAUDIOINITSTATE_IN_INIT; 1481 1473 … … 1519 1511 * Assign device to the queue. 1520 1512 */ 1521 UInt32 uSize = sizeof( pDev->UUID);1522 orc = AudioQueueSetProperty(pStreamCA->hAudioQueue, kAudioQueueProperty_CurrentDevice, & pDev->UUID, uSize);1513 UInt32 uSize = sizeof(hDevUidStr); 1514 orc = AudioQueueSetProperty(pStreamCA->hAudioQueue, kAudioQueueProperty_CurrentDevice, &hDevUidStr, uSize); 1523 1515 LogFlowFunc(("AudioQueueSetProperty -> %#x\n", orc)); 1524 1516 if (orc == noErr) … … 1610 1602 1611 1603 LogFunc(("returns VINF_SUCCESS\n")); 1604 CFRelease(hDevUidStr); 1612 1605 return VINF_SUCCESS; 1613 1606 } 1607 1614 1608 RTMemFree(pStreamCA->paBuffers); 1615 1609 } … … 1627 1621 else 1628 1622 LogRel(("CoreAudio: Failed to initialize critical section for stream: %Rrc\n", rc)); 1623 CFRelease(hDevUidStr); 1629 1624 } 1630 1625 else … … 1735 1730 1736 1731 /* 1737 * Release the device and delete the critsect.1732 * Delete the critsect and we're done. 1738 1733 */ 1739 pStreamCA->Unit.pDevice = NULL; /** @todo This bugger must be refcounted! */1740 1741 1734 RTCritSectDelete(&pStreamCA->CritSect); 1742 1735 1743 /*1744 * Done.1745 */1746 1736 ASMAtomicWriteU32(&pStreamCA->enmInitState, COREAUDIOINITSTATE_UNINIT); 1747 1737 }
Note:
See TracChangeset
for help on using the changeset viewer.