- Timestamp:
- Apr 7, 2021 11:03:58 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 143642
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp
r88390 r88394 37 37 /** Audio file to dump output to or read input from. */ 38 38 PPDMAUDIOFILE pFile; 39 /** Text file to store timing of audio buffers submittions **/39 /** Text file to store timing of audio buffers submittions. */ 40 40 RTFILE hFileTiming; 41 /** Timestamp of the first play or record request **/41 /** Timestamp of the first play or record request. */ 42 42 uint64_t tsStarted; 43 /** Total number of samples played or recorded so far**/44 uint32_t uSamplesSinceStarted;43 /** Total number of frames played or recorded so far. */ 44 uint32_t cFramesSinceStarted; 45 45 union 46 46 { … … 122 122 123 123 pStreamDbg->tsStarted = 0; 124 pStreamDbg-> uSamplesSinceStarted = 0;124 pStreamDbg->cFramesSinceStarted = 0; 125 125 pStreamDbg->Out.tsLastPlayed = 0; 126 126 pStreamDbg->Out.cbPlayBuffer = PDMAudioPropsFramesToBytes(&pCfgReq->Props, pCfgReq->Backend.cFramesBufferSize); … … 197 197 */ 198 198 static DECLCALLBACK(int) drvHostValKitAudioHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 199 const void *pvBuf, uint32_t uBufSize, uint32_t *puWritten)200 { 201 PDRVHOSTVAKITAUDIO p Drv= RT_FROM_MEMBER(pInterface, DRVHOSTVAKITAUDIO, IHostAudio);199 const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten) 200 { 201 PDRVHOSTVAKITAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVHOSTVAKITAUDIO, IHostAudio); 202 202 PVAKITAUDIOSTREAM pStreamDbg = (PVAKITAUDIOSTREAM)pStream; 203 RT_NOREF(pDrv); 204 205 uint64_t tsSinceStart; 206 size_t cch; 203 RT_NOREF(pThis); 204 205 uint64_t cNsSinceStart; 206 if (pStreamDbg->tsStarted != 0) 207 cNsSinceStart = RTTimeNanoTS() - pStreamDbg->tsStarted; 208 else 209 { 210 pStreamDbg->tsStarted = RTTimeNanoTS(); 211 cNsSinceStart = 0; 212 } 213 214 // Microseconds are used everythere below 215 uint32_t const cFrames = PDMAudioPropsBytesToFrames(&pStreamDbg->pCfg->Props, cbBuf); 207 216 char szTimingInfo[128]; 208 209 if (pStreamDbg->tsStarted == 0) 210 { 211 pStreamDbg->tsStarted = RTTimeNanoTS(); 212 tsSinceStart = 0; 213 } 214 else 215 { 216 tsSinceStart = RTTimeNanoTS() - pStreamDbg->tsStarted; 217 } 218 219 // Microseconds are used everythere below 220 uint32_t sBuf = uBufSize >> pStreamDbg->pCfg->Props.cShift; 221 cch = RTStrPrintf(szTimingInfo, sizeof(szTimingInfo), "%d %d %d %d\n", 222 (uint32_t)(tsSinceStart / 1000), // Host time elapsed since Guest submitted the first buffer for playback 223 (uint32_t)(pStreamDbg->uSamplesSinceStarted * 1.0E6 / pStreamDbg->pCfg->Props.uHz), // how long all the samples submitted previously were played 224 (uint32_t)(sBuf * 1.0E6 / pStreamDbg->pCfg->Props.uHz), // how long a new uSamplesReady samples should\will be played 225 sBuf); 217 size_t cch = RTStrPrintf(szTimingInfo, sizeof(szTimingInfo), "%d %d %d %d\n", 218 // Host time elapsed since Guest submitted the first buffer for playback: 219 (uint32_t)(cNsSinceStart / 1000), 220 // how long all the samples submitted previously were played: 221 (uint32_t)(pStreamDbg->cFramesSinceStarted * 1.0E6 / pStreamDbg->pCfg->Props.uHz), 222 // how long a new uSamplesReady samples should/will be played: 223 (uint32_t)(cFrames * 1.0E6 / pStreamDbg->pCfg->Props.uHz), 224 cFrames); 226 225 RTFileWrite(pStreamDbg->hFileTiming, szTimingInfo, cch, NULL); 227 pStreamDbg-> uSamplesSinceStarted += sBuf;226 pStreamDbg->cFramesSinceStarted += cFrames; 228 227 229 228 /* Remember when samples were consumed. */ 230 // pStreamDbg->Out.tsLastPlayed = PDMDrvHlpTMGetVirtualTime(p Drv->pDrvIns);;231 232 int rc2 = AudioHlpFileWrite(pStreamDbg->pFile, pvBuf, uBufSize, 0 /* fFlags */);229 // pStreamDbg->Out.tsLastPlayed = PDMDrvHlpTMGetVirtualTime(pThis->pDrvIns); 230 231 int rc2 = AudioHlpFileWrite(pStreamDbg->pFile, pvBuf, cbBuf, 0 /* fFlags */); 233 232 if (RT_FAILURE(rc2)) 234 233 LogRel(("VaKitAudio: Writing output failed with %Rrc\n", rc2)); 235 234 236 *p uWritten = uBufSize;235 *pcbWritten = cbBuf; 237 236 238 237 return VINF_SUCCESS; -
trunk/src/VBox/Main/src-client/DrvAudioRec.cpp
r88390 r88394 653 653 */ 654 654 static DECLCALLBACK(int) drvAudioVideoRecHA_StreamPlay(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDSTREAM pStream, 655 const void *pvBuf, uint32_t uBufSize, uint32_t *puWritten) 656 { 657 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); 658 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 659 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); 660 AssertReturn(uBufSize, VERR_INVALID_PARAMETER); 661 /* puWritten is optional. */ 662 663 PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface); 655 const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten) 656 { 664 657 RT_NOREF(pThis); 665 PAVRECSTREAM pStreamAV = (PAVRECSTREAM)pStream; 658 PAVRECSTREAM pStreamAV = (PAVRECSTREAM)pStream; 659 AssertPtrReturn(pStreamAV, VERR_INVALID_POINTER); 660 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); 661 AssertReturn(cbBuf, VERR_INVALID_PARAMETER); 662 AssertReturn(pcbWritten, VERR_INVALID_PARAMETER); 666 663 667 664 int rc = VINF_SUCCESS; … … 683 680 size_t cbCircBuf; 684 681 685 uint32_t cbToWrite = uBufSize;682 uint32_t cbToWrite = cbBuf; 686 683 687 684 /* … … 821 818 } 822 819 823 if (puWritten) 824 *puWritten = cbWrittenTotal; 820 *pcbWritten = cbWrittenTotal; 825 821 #else 826 822 /* Report back all data as being processed. */ 827 if (puWritten) 828 *puWritten = uBufSize; 823 *pcbWritten = cbBuf; 829 824 830 825 rc = VERR_NOT_SUPPORTED;
Note:
See TracChangeset
for help on using the changeset viewer.