- Timestamp:
- Jun 19, 2017 11:13:52 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r67448 r67469 139 139 140 140 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 141 static void drvAudioDbgPCMDumpA(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData); 141 static char *drvAudioDbgGetFileNameA(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix); 142 static void drvAudioDbgPCMDelete(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix); 143 static void drvAudioDbgPCMDump(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData); 142 144 #endif 143 145 … … 967 969 pGstStream->szName, pszGstSts, pszHstSts, cbBuf, csWritten, rc)); 968 970 } 971 #endif 972 973 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 974 drvAudioDbgPCMDump(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "StreamWrite.pcm", pvBuf, cbBuf); 969 975 #endif 970 976 … … 1321 1327 1322 1328 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 1323 drvAudioDbgPCMDump A(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "PlayNonInterleaved.pcm",1324 1329 drvAudioDbgPCMDump(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "PlayNonInterleaved.pcm", 1330 auBuf, cbPlayed); 1325 1331 #endif 1326 1332 AssertMsg(cbPlayed <= cbRead, ("Played more than available (%RU32 available but got %RU32)\n", cbRead, cbPlayed)); … … 1605 1611 { 1606 1612 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 1607 drvAudioDbgPCMDump A(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "CaptureNonInterleaved.pcm",1608 1613 drvAudioDbgPCMDump(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "CaptureNonInterleaved.pcm", 1614 auBuf, cbCaptured); 1609 1615 #endif 1610 1616 Assert(cbCaptured <= cbBuf); … … 2074 2080 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 2075 2081 /** 2082 * Returns an unique file name for this given audio connector instance. 2083 * 2084 * @return Allocated file name. Must be free'd using RTStrFree(). 2085 * @param pThis Driver instance. 2086 * @param pszPath Path name of the file to delete. The path must exist. 2087 * @param pszSuffix File name suffix to use. 2088 */ 2089 static char *drvAudioDbgGetFileNameA(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix) 2090 { 2091 char szFileName[64]; 2092 RTStrPrintf(szFileName, sizeof(szFileName), "drvAudio%RU32-%s", pThis->pDrvIns->iInstance, pszSuffix); 2093 2094 char szFilePath[RTPATH_MAX]; 2095 int rc2 = RTStrCopy(szFilePath, sizeof(szFilePath), pszPath); 2096 AssertRC(rc2); 2097 rc2 = RTPathAppend(szFilePath, sizeof(szFilePath), szFileName); 2098 AssertRC(rc2); 2099 2100 return RTStrDup(szFilePath); 2101 } 2102 2103 /** 2104 * Deletes a PCM audio dump file. 2105 * 2106 * @param pThis Driver instance. 2107 * @param pszPath Path name of the file to delete. The path must exist. 2108 * @param pszSuffix File name suffix to use. 2109 */ 2110 static void drvAudioDbgPCMDelete(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix) 2111 { 2112 char *pszFileName = drvAudioDbgGetFileNameA(pThis, pszPath, pszSuffix); 2113 AssertPtr(pszFileName); 2114 2115 RTFileDelete(pszFileName); 2116 2117 RTStrFree(pszFileName); 2118 } 2119 2120 /** 2076 2121 * Dumps (raw) PCM audio data into a file by appending. 2077 2122 * Every driver instance will have an own prefix to not introduce writing races. … … 2083 2128 * @param cbData Size (in bytes) of PCM data to dump. 2084 2129 */ 2085 static void drvAudioDbgPCMDump A(PDRVAUDIO pThis,2086 2130 static void drvAudioDbgPCMDump(PDRVAUDIO pThis, 2131 const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData) 2087 2132 { 2088 2133 if (!pvData || !cbData) … … 2091 2136 AssertPtr(pThis->pDrvIns); 2092 2137 2093 char szFileName[64]; 2094 RTStrPrintf(szFileName, sizeof(szFileName), "drvAudio%RU32-%s", pThis->pDrvIns->iInstance, pszSuffix); 2095 2096 char szFilePath[RTPATH_MAX]; 2097 int rc2 = RTStrCopy(szFilePath, sizeof(szFilePath), pszPath); 2098 AssertRC(rc2); 2099 rc2 = RTPathAppend(szFilePath, sizeof(szFilePath), szFileName); 2100 AssertRC(rc2); 2138 char *pszFileName = drvAudioDbgGetFileNameA(pThis, pszPath, pszSuffix); 2139 AssertPtr(pszFileName); 2101 2140 2102 2141 RTFILE fh; 2103 rc2 = RTFileOpen(&fh, szFilePath, 2104 RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 2142 int rc2 = RTFileOpen(&fh, pszFileName, RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE); 2105 2143 AssertRC(rc2); 2106 2144 if (RT_SUCCESS(rc2)) … … 2109 2147 RTFileClose(fh); 2110 2148 } 2149 2150 RTStrFree(pszFileName); 2111 2151 } 2112 2152 #endif /* VBOX_AUDIO_DEBUG_DUMP_PCM_DATA */ … … 2295 2335 { 2296 2336 cbRead = AUDIOMIXBUF_S2B(&pGstStream->MixBuf, cRead); 2337 2338 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 2339 drvAudioDbgPCMDump(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "StreamRead.pcm", pvBuf, cbRead); 2340 #endif 2297 2341 2298 2342 #ifdef VBOX_WITH_STATISTICS … … 3151 3195 PDMDrvHlpSTAMRegProfileAdvEx(pDrvIns, &pThis->Stats.DelayOut, "DelayOut", 3152 3196 STAMUNIT_NS_PER_CALL, "Profiling of output data processing."); 3197 #endif 3198 3199 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA 3200 drvAudioDbgPCMDelete(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "StreamRead.pcm"); 3201 drvAudioDbgPCMDelete(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "StreamWrite.pcm"); 3202 drvAudioDbgPCMDelete(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "PlayNonInterleaved.pcm"); 3203 drvAudioDbgPCMDelete(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "CaptureNonInterleaved.pcm"); 3153 3204 #endif 3154 3205 }
Note:
See TracChangeset
for help on using the changeset viewer.