VirtualBox

Changeset 67469 in vbox for trunk/src


Ignore:
Timestamp:
Jun 19, 2017 11:13:52 AM (8 years ago)
Author:
vboxsync
Message:

Audio/DrvAudio.cpp: Added drvAudioDbgGetFileNameA() + drvAudioDbgPCMDelete(). More PCM debug output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r67448 r67469  
    139139
    140140#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);
     141static char *drvAudioDbgGetFileNameA(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix);
     142static void  drvAudioDbgPCMDelete(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix);
     143static void  drvAudioDbgPCMDump(PDRVAUDIO pThis, const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData);
    142144#endif
    143145
     
    967969                             pGstStream->szName, pszGstSts, pszHstSts, cbBuf, csWritten, rc));
    968970        }
     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);
    969975#endif
    970976
     
    13211327
    13221328#ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    1323                 drvAudioDbgPCMDumpA(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "PlayNonInterleaved.pcm",
    1324                                     auBuf, cbPlayed);
     1329                drvAudioDbgPCMDump(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "PlayNonInterleaved.pcm",
     1330                                   auBuf, cbPlayed);
    13251331#endif
    13261332                AssertMsg(cbPlayed <= cbRead, ("Played more than available (%RU32 available but got %RU32)\n", cbRead, cbPlayed));
     
    16051611        {
    16061612#ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    1607             drvAudioDbgPCMDumpA(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "CaptureNonInterleaved.pcm",
    1608                                 auBuf, cbCaptured);
     1613            drvAudioDbgPCMDump(pThis, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH, "CaptureNonInterleaved.pcm",
     1614                               auBuf, cbCaptured);
    16091615#endif
    16101616            Assert(cbCaptured <= cbBuf);
     
    20742080#ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
    20752081/**
     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 */
     2089static 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 */
     2110static 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/**
    20762121 * Dumps (raw) PCM audio data into a file by appending.
    20772122 * Every driver instance will have an own prefix to not introduce writing races.
     
    20832128 * @param   cbData              Size (in bytes) of PCM data to dump.
    20842129 */
    2085 static void drvAudioDbgPCMDumpA(PDRVAUDIO pThis,
    2086                                 const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData)
     2130static void drvAudioDbgPCMDump(PDRVAUDIO pThis,
     2131                               const char *pszPath, const char *pszSuffix, const void *pvData, size_t cbData)
    20872132{
    20882133    if (!pvData || !cbData)
     
    20912136    AssertPtr(pThis->pDrvIns);
    20922137
    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);
    21012140
    21022141    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);
    21052143    AssertRC(rc2);
    21062144    if (RT_SUCCESS(rc2))
     
    21092147        RTFileClose(fh);
    21102148    }
     2149
     2150    RTStrFree(pszFileName);
    21112151}
    21122152#endif /* VBOX_AUDIO_DEBUG_DUMP_PCM_DATA */
     
    22952335            {
    22962336                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
    22972341
    22982342#ifdef VBOX_WITH_STATISTICS
     
    31513195        PDMDrvHlpSTAMRegProfileAdvEx(pDrvIns, &pThis->Stats.DelayOut,          "DelayOut",
    31523196                                     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");
    31533204#endif
    31543205    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette