Changeset 88412 in vbox
- Timestamp:
- Apr 8, 2021 12:00:08 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmaudioifs.h
r88390 r88412 994 994 995 995 996 /** @todo r=bird: What is this exactly? */997 #define PPDMAUDIOBACKENDSTREAM void *998 999 1000 996 /** Pointer to a audio connector interface. */ 1001 997 typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR; … … 1203 1199 #define PDMIAUDIOCONNECTOR_IID "122511ca-deb3-4630-ad31-ade9f3177df4" 1204 1200 1201 1202 /** Opque pointer host audio specific stream data. 1203 * @todo r=bird: should extend this to a public part that at least includes a 1204 * PPDMAUDIOSTREAM member. */ 1205 typedef struct PDMAUDIOBACKENDSTREAM *PPDMAUDIOBACKENDSTREAM; 1205 1206 1206 1207 /** Pointer to a host audio interface. */ -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88390 r88412 98 98 * 99 99 * That way the backends do not have access to the audio connector's data. */ 100 void *pvBackend;100 PPDMAUDIOBACKENDSTREAM pBackend; 101 101 102 102 /** For output streams this indicates whether the stream has reached … … 779 779 { 780 780 if (fEnabled) 781 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->p vBackend, PDMAUDIOSTREAMCMD_ENABLE);781 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_ENABLE); 782 782 break; 783 783 } … … 785 785 case PDMAUDIOSTREAMCMD_DISABLE: 786 786 { 787 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->p vBackend, PDMAUDIOSTREAMCMD_DISABLE);787 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_DISABLE); 788 788 break; 789 789 } … … 792 792 { 793 793 if (fEnabled) /* Needed, as resume below also is being checked for. */ 794 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->p vBackend, PDMAUDIOSTREAMCMD_PAUSE);794 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_PAUSE); 795 795 break; 796 796 } … … 799 799 { 800 800 if (fEnabled) 801 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->p vBackend, PDMAUDIOSTREAMCMD_RESUME);801 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_RESUME); 802 802 break; 803 803 } … … 805 805 case PDMAUDIOSTREAMCMD_DRAIN: 806 806 { 807 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->p vBackend, PDMAUDIOSTREAMCMD_DRAIN);807 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_DRAIN); 808 808 break; 809 809 } … … 811 811 case PDMAUDIOSTREAMCMD_DROP: 812 812 { 813 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->p vBackend, PDMAUDIOSTREAMCMD_DROP);813 rc = pThis->pHostDrvAudio->pfnStreamControl(pThis->pHostDrvAudio, pStreamEx->pBackend, PDMAUDIOSTREAMCMD_DROP); 814 814 break; 815 815 } … … 849 849 850 850 pStreamEx->Core.uMagic = ~PDMAUDIOSTREAM_MAGIC; 851 pStreamEx->p vBackend= NULL;851 pStreamEx->pBackend = NULL; 852 852 pStreamEx->uMagic = DRVAUDIOSTREAM_MAGIC_DEAD; 853 853 … … 1046 1046 if ( !pThis->Out.fEnabled /* (see @bugref{9882}) */ 1047 1047 || pThis->pHostDrvAudio == NULL /* (we used to work this condition differently) */ 1048 || !PDMAudioStrmStatusCanWrite(pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->p vBackend)))1048 || !PDMAudioStrmStatusCanWrite(pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->pBackend))) 1049 1049 { 1050 1050 Log3Func(("[%s] Backend stream %s, discarding the data\n", pStreamEx->Core.szName, … … 1357 1357 if (pThis->pHostDrvAudio->pfnStreamGetPending) /* Optional to implement. */ 1358 1358 { 1359 const uint32_t cxPending = pThis->pHostDrvAudio->pfnStreamGetPending(pThis->pHostDrvAudio, pStreamEx->p vBackend);1359 const uint32_t cxPending = pThis->pHostDrvAudio->pfnStreamGetPending(pThis->pHostDrvAudio, pStreamEx->pBackend); 1360 1360 Log3Func(("[%s] cxPending=%RU32\n", pStreamEx->Core.szName, cxPending)); 1361 1361 … … 1472 1472 uint32_t cFramesPlayed = 0; 1473 1473 uint32_t cbPlayed = 0; 1474 rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pStreamEx->p vBackend, abChunk, cbRead, &cbPlayed);1474 rc = pThis->pHostDrvAudio->pfnStreamPlay(pThis->pHostDrvAudio, pStreamEx->pBackend, abChunk, cbRead, &cbPlayed); 1475 1475 if (RT_SUCCESS(rc)) 1476 1476 { … … 1549 1549 some heuristics based on number of writable bytes now compared to when 1550 1550 prebuffering ended the first time around. */ 1551 uint32_t cbBuffered = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->p vBackend);1551 uint32_t cbBuffered = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend); 1552 1552 if (cbBuffered < pStreamEx->Out.cbBackendMaxWritable) 1553 1553 cbBuffered = pStreamEx->Out.cbBackendMaxWritable - cbBuffered; … … 1580 1580 { 1581 1581 /* not-prebuffering, likely after a while at least */ 1582 cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->p vBackend);1582 cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend); 1583 1583 } 1584 1584 else … … 1618 1618 1619 1619 /* Hack alert! This is for the underrun detection. */ 1620 cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->p vBackend);1620 cbWritable = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend); 1621 1621 if (cbWritable > pStreamEx->Out.cbBackendMaxWritable) 1622 1622 pStreamEx->Out.cbBackendMaxWritable = cbWritable; … … 1648 1648 pStreamEx->nsLastPlayedCaptured = RTTimeNanoTS(); 1649 1649 pStreamEx->Out.Stats.cbBackendWritableAfter = pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, 1650 pStreamEx->p vBackend);1650 pStreamEx->pBackend); 1651 1651 } 1652 1652 else … … 1727 1727 */ 1728 1728 AssertPtr(pThis->pHostDrvAudio->pfnStreamGetReadable); 1729 uint32_t cbReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->p vBackend);1729 uint32_t cbReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pBackend); 1730 1730 if (!cbReadable) 1731 1731 Log2Func(("[%s] No readable data available\n", pStreamEx->Core.szName)); … … 1747 1747 uint8_t abChunk[_4K]; 1748 1748 uint32_t cbCaptured; 1749 rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->p vBackend,1749 rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->pBackend, 1750 1750 abChunk, RT_MIN(cbReadable, (uint32_t)sizeof(abChunk)), &cbCaptured); 1751 1751 if (RT_FAILURE(rc)) … … 1829 1829 */ 1830 1830 /* Note: Raw means *audio frames*, not bytes! */ 1831 uint32_t cfReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->p vBackend);1831 uint32_t cfReadable = pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pBackend); 1832 1832 if (!cfReadable) 1833 1833 Log2Func(("[%s] No readable data available\n", pStreamEx->Core.szName)); … … 1855 1855 1856 1856 uint32_t cfCaptured; 1857 rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->p vBackend,1857 rc = pThis->pHostDrvAudio->pfnStreamCapture(pThis->pHostDrvAudio, pStreamEx->pBackend, 1858 1858 paFrames, cfWritable, &cfCaptured); 1859 1859 if (RT_FAILURE(rc)) … … 2409 2409 AssertPtr(pThis->pHostDrvAudio); 2410 2410 if (pThis->pHostDrvAudio) 2411 rc = pThis->pHostDrvAudio->pfnStreamCreate(pThis->pHostDrvAudio, pStreamEx->p vBackend, pCfgReq, pCfgAcq);2411 rc = pThis->pHostDrvAudio->pfnStreamCreate(pThis->pHostDrvAudio, pStreamEx->pBackend, pCfgReq, pCfgAcq); 2412 2412 else 2413 2413 rc = VERR_PDM_NO_ATTACHED_DRIVER; … … 2798 2798 pStreamEx->Core.cbBackend = (uint32_t)cbHstStrm; 2799 2799 if (cbHstStrm) 2800 pStreamEx->p vBackend = pStreamEx + 1;2800 pStreamEx->pBackend = (PPDMAUDIOBACKENDSTREAM)(pStreamEx + 1); 2801 2801 pStreamEx->fNoMixBufs = RT_BOOL(fFlags & PDMAUDIOSTREAM_CREATE_F_NO_MIXBUF); 2802 2802 pStreamEx->uMagic = DRVAUDIOSTREAM_MAGIC; … … 3038 3038 { 3039 3039 if (pStreamEx->fNoMixBufs) 3040 cbReadable = pThis->pHostDrvAudio ? pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStream) : 0; 3040 cbReadable = pThis->pHostDrvAudio 3041 ? pThis->pHostDrvAudio->pfnStreamGetReadable(pThis->pHostDrvAudio, pStreamEx->pBackend) : 0; 3041 3042 else 3042 3043 { … … 3057 3058 PDMAUDIOSTREAMSTS fStatus = PDMAUDIOSTREAMSTS_FLAGS_NONE; 3058 3059 if (pThis->pHostDrvAudio->pfnStreamGetStatus) 3059 fStatus = pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->p vBackend);3060 fStatus = pThis->pHostDrvAudio->pfnStreamGetStatus(pThis->pHostDrvAudio, pStreamEx->pBackend); 3060 3061 if ( !PDMAudioStrmStatusCanRead(fStatus) 3061 3062 || fDisabled) … … 3112 3113 { 3113 3114 if (pStreamEx->fNoMixBufs) 3114 cbWritable = pThis->pHostDrvAudio ? pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStream) : 0; 3115 cbWritable = pThis->pHostDrvAudio 3116 ? pThis->pHostDrvAudio->pfnStreamGetWritable(pThis->pHostDrvAudio, pStreamEx->pBackend) : 0; 3115 3117 else 3116 3118 cbWritable = AudioMixBufFreeBytes(&pStreamEx->Host.MixBuf); … … 3204 3206 if (pStreamEx->Core.fStatus & PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED) 3205 3207 { 3206 AssertPtr(pStreamEx->p vBackend);3208 AssertPtr(pStreamEx->pBackend); 3207 3209 3208 3210 /* Check if the pointer to the host audio driver is still valid. 3209 3211 * It can be NULL if we were called in drvAudioDestruct, for example. */ 3210 3212 if (pThis->pHostDrvAudio) 3211 rc = pThis->pHostDrvAudio->pfnStreamDestroy(pThis->pHostDrvAudio, pStreamEx->p vBackend);3213 rc = pThis->pHostDrvAudio->pfnStreamDestroy(pThis->pHostDrvAudio, pStreamEx->pBackend); 3212 3214 3213 3215 pStreamEx->Core.fStatus &= ~PDMAUDIOSTREAMSTS_FLAGS_INITIALIZED; -
trunk/src/VBox/Devices/Audio/DrvHostAudioDSound.cpp
r88390 r88412 2065 2065 } 2066 2066 2067 static int dsoundDestroyStreamOut(PDRVHOSTDSOUND pThis, PPDMAUDIOBACKENDSTREAM pStream) 2068 { 2069 PDSOUNDSTREAM pStreamDS = (PDSOUNDSTREAM)pStream; 2070 2067 static int dsoundDestroyStreamOut(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS) 2068 { 2071 2069 LogFlowFuncEnter(); 2072 2070
Note:
See TracChangeset
for help on using the changeset viewer.