VirtualBox

Changeset 89984 in vbox


Ignore:
Timestamp:
Jul 1, 2021 8:36:56 AM (4 years ago)
Author:
vboxsync
Message:

Audio/ValKit: More code for test (set) verification. bugref:10008

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

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

    r89966 r89984  
    6464
    6565/** Test manifest header name. */
    66 #define AUDIOTEST_INI_SEC_HDR_STR   "header"
     66#define AUDIOTEST_SEC_HDR_STR        "header"
     67/** Maximum section name length (in UTF-8 characters). */
     68#define AUDIOTEST_MAX_SEC_LEN        128
     69/** Maximum object name length (in UTF-8 characters). */
     70#define AUDIOTEST_MAX_OBJ_LEN        128
    6771
    6872
     
    7276/**
    7377 * Structure for an internal object handle.
    74  *
    75  * As we only support .INI-style files for now, this only has the object's section name in it.
    7678 */
    7779typedef struct AUDIOTESTOBJHANDLE
    7880{
    79     char szSec[128];
     81    /** Pointer to test set this handle is bound to. */
     82    PAUDIOTESTSET       pSet;
     83    /** As we only support .INI-style files for now, this only has the object's section name in it. */
     84    /** @todo Make this more generic (union, ++). */
     85    char                szSec[AUDIOTEST_MAX_SEC_LEN];
    8086} AUDIOTESTOBJHANDLE;
    8187/** Pointer to an audio test object handle. */
     
    97103    /** Flag indicating whether to keep going after an error has occurred. */
    98104    bool                fKeepGoing;
     105    /** PCM properties to use for verification. */
     106    PDMAUDIOPCMPROPS    PCMProps;
    99107} AUDIOTESTVERIFYJOB;
    100108/** Pointer to an audio test verification job. */
     
    687695
    688696/**
     697 * Gets a value as string.
     698 *
     699 * @returns VBox status code.
     700 * @param   phObj               Object handle to get value for.
     701 * @param   pszKey              Key to get value from.
     702 * @param   pszVal              Where to return the value on success.
     703 * @param   cbVal               Size (in bytes) of \a pszVal.
     704 */
     705static int audioTestObjGetStr(PAUDIOTESTOBJHANDLE phObj, const char *pszKey, char *pszVal, size_t cbVal)
     706{
     707    /** @todo For now we only support .INI-style files. */
     708    AssertPtrReturn(phObj->pSet, VERR_WRONG_ORDER);
     709    return RTIniFileQueryValue(phObj->pSet->f.hIniFile, phObj->szSec, pszKey, pszVal, cbVal, NULL);
     710}
     711
     712/**
     713 * Gets a value as boolean.
     714 *
     715 * @returns VBox status code.
     716 * @param   phObj               Object handle to get value for.
     717 * @param   pszKey              Key to get value from.
     718 * @param   pbVal               Where to return the value on success.
     719 */
     720static int audioTestObjGetBool(PAUDIOTESTOBJHANDLE phObj, const char *pszKey, bool *pbVal)
     721{
     722    char szVal[_1K];
     723    int rc = audioTestObjGetStr(phObj, pszKey, szVal, sizeof(szVal));
     724    if (RT_SUCCESS(rc))
     725        *pbVal = RT_BOOL(RTStrToUInt8(szVal));
     726
     727    return rc;
     728}
     729
     730/**
     731 * Gets a value as uint8_t.
     732 *
     733 * @returns VBox status code.
     734 * @param   phObj               Object handle to get value for.
     735 * @param   pszKey              Key to get value from.
     736 * @param   puVal               Where to return the value on success.
     737 */
     738static int audioTestObjGetUInt8(PAUDIOTESTOBJHANDLE phObj, const char *pszKey, uint8_t *puVal)
     739{
     740    char szVal[_1K];
     741    int rc = audioTestObjGetStr(phObj, pszKey, szVal, sizeof(szVal));
     742    if (RT_SUCCESS(rc))
     743        *puVal = RTStrToUInt8(szVal);
     744
     745    return rc;
     746}
     747
     748/**
     749 * Gets a value as uint32_t.
     750 *
     751 * @returns VBox status code.
     752 * @param   phObj               Object handle to get value for.
     753 * @param   pszKey              Key to get value from.
     754 * @param   puVal               Where to return the value on success.
     755 */
     756static int audioTestObjGetUInt32(PAUDIOTESTOBJHANDLE phObj, const char *pszKey, uint32_t *puVal)
     757{
     758    char szVal[_1K];
     759    int rc = audioTestObjGetStr(phObj, pszKey, szVal, sizeof(szVal));
     760    if (RT_SUCCESS(rc))
     761        *puVal = RTStrToUInt32(szVal);
     762
     763    return rc;
     764}
     765
     766/**
    689767 * Returns the absolute path of a given audio test set object.
    690768 *
     
    9601038        rc = audioTestManifestWrite(pSet, "\n");
    9611039        AssertRCReturn(rc, rc);
    962         char szUuid[64];
     1040        char szUuid[AUDIOTEST_MAX_SEC_LEN];
    9631041        rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid));
    9641042        AssertRCReturn(rc, rc);
     
    10951173            rc = RTUuidCreate(&pObj->Uuid);
    10961174            AssertRCReturn(rc, rc);
    1097             char szUuid[64];
     1175            char szUuid[AUDIOTEST_MAX_OBJ_LEN];
    10981176            rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid));
    10991177            AssertRCReturn(rc, rc);
     
    14541532
    14551533/**
    1456  * Gets a value as string.
    1457  *
    1458  * @returns VBox status code.
    1459  * @param   pSet                Test set to get value from.
    1460  * @param   phObj               Object handle to get value for.
    1461  * @param   pszKey              Key to get value from.
    1462  * @param   pszVal              Where to return the value on success.
    1463  * @param   cbVal               Size (in bytes) of \a pszVal.
    1464  */
    1465 static int audioTestGetValueStr(PAUDIOTESTSET pSet,
    1466                                 PAUDIOTESTOBJHANDLE phObj, const char *pszKey, char *pszVal, size_t cbVal)
    1467 {
    1468     return RTIniFileQueryValue(pSet->f.hIniFile, phObj->szSec, pszKey, pszVal, cbVal, NULL);
    1469 }
    1470 
    1471 /**
    1472  * Gets a value as uint32_t.
    1473  *
    1474  * @returns VBox status code.
    1475  * @param   pSet                Test set to get value from.
    1476  * @param   phObj               Object handle to get value for.
    1477  * @param   pszKey              Key to get value from.
    1478  * @param   puVal               Where to return the value on success.
    1479  */
    1480 static int audioTestGetValueUInt32(PAUDIOTESTSET pSet,
    1481                                    PAUDIOTESTOBJHANDLE phObj, const char *pszKey, uint32_t *puVal)
    1482 {
    1483     char szVal[_1K];
    1484     int rc = audioTestGetValueStr(pSet, phObj, pszKey, szVal, sizeof(szVal));
     1534 * Retrieves an object handle of a specific test set section.
     1535 *
     1536 * @returns VBox status code.
     1537 * @param   pSet                Test set the section contains.
     1538 * @param   pszSec              Name of section to retrieve object handle for.
     1539 * @param   phSec               Where to store the object handle on success.
     1540 * @note
     1541 */
     1542
     1543/** @copydoc <struct>::pfnXXX */
     1544static int audioTestSetGetSection(PAUDIOTESTSET pSet, const char *pszSec, PAUDIOTESTOBJHANDLE phSec)
     1545{
     1546    int rc = RTStrCopy(phSec->szSec, sizeof(phSec->szSec), pszSec);
     1547    if (RT_FAILURE(rc))
     1548        return rc;
     1549
     1550    phSec->pSet = pSet;
     1551
     1552    /** @todo Check for section existence. */
     1553    RT_NOREF(pSet);
     1554
     1555    return VINF_SUCCESS;
     1556}
     1557
     1558/**
     1559 * Retrieves an object handle of a specific test.
     1560 *
     1561 * @returns VBox status code.
     1562 * @param   pSet                Test set the test contains.
     1563 * @param   idxTst              Index of test to retrieve the object handle for.
     1564 * @param   phTst               Where to store the object handle on success.
     1565 */
     1566static int audioTestSetGetTest(PAUDIOTESTSET pSet, uint32_t idxTst, PAUDIOTESTOBJHANDLE phTst)
     1567{
     1568    char szSec[AUDIOTEST_MAX_SEC_LEN];
     1569    if (RTStrPrintf2(szSec, sizeof(szSec), "test_%04RU32", idxTst) <= 0)
     1570        return VERR_BUFFER_OVERFLOW;
     1571
     1572    return audioTestSetGetSection(pSet, szSec, phTst);
     1573}
     1574
     1575/**
     1576 * Retrieves an object handle of a specific object.
     1577 *
     1578 * @returns VBox status code.
     1579 * @param   phParent            Object handle (parent) the object contains.
     1580 * @param   idxObj              Index of object to retrieve the object handle for.
     1581 * @param   phObj               Where to store the object handle on success.
     1582 */
     1583static int audioTestSetGetObj(PAUDIOTESTOBJHANDLE phParent, uint32_t idxObj, PAUDIOTESTOBJHANDLE phObj)
     1584{
     1585    char szObj[AUDIOTEST_MAX_SEC_LEN];
     1586    if (RTStrPrintf2(szObj, sizeof(szObj), "obj%RU32_uuid", idxObj) <= 0)
     1587        AssertFailedReturn(VERR_BUFFER_OVERFLOW);
     1588
     1589    char szUuid[AUDIOTEST_MAX_SEC_LEN];
     1590    int rc = audioTestObjGetStr(phParent, szObj, szUuid, sizeof(szUuid));
    14851591    if (RT_SUCCESS(rc))
    1486         *puVal = RTStrToUInt32(szVal);
     1592    {
     1593        if (RTStrPrintf2(phObj->szSec, sizeof(phObj->szSec), "obj_%s", szUuid) <= 0)
     1594            AssertFailedReturn(VERR_BUFFER_OVERFLOW);
     1595
     1596        /** @todo Check test section existence. */
     1597
     1598        phObj->pSet = phParent->pSet;
     1599    }
    14871600
    14881601    return rc;
     
    14951608 * @returns Error if the verification failed and test verification job has fKeepGoing not set.
    14961609 * @param   pVerify             Verification job to verify value for.
    1497  * @param   phObj               Object handle to verify value for.
     1610 * @param   phObjA              Object handle A to verify value for.
     1611 * @param   phObjB              Object handle B to verify value for.
    14981612 * @param   pszKey              Key to verify.
    14991613 * @param   pszVal              Value to verify.
     
    15021616 */
    15031617static int audioTestVerifyValue(PAUDIOTESTVERIFYJOB pVerify,
    1504                                 PAUDIOTESTOBJHANDLE phObj, const char *pszKey, const char *pszVal, const char *pszErrFmt, ...)
     1618                                PAUDIOTESTOBJHANDLE phObjA, PAUDIOTESTOBJHANDLE phObjB, const char *pszKey, const char *pszVal, const char *pszErrFmt, ...)
    15051619{
    15061620    va_list va;
     
    15081622
    15091623    char szValA[_1K];
    1510     int rc = audioTestGetValueStr(pVerify->pSetA, phObj, pszKey, szValA, sizeof(szValA));
     1624    int rc = audioTestObjGetStr(phObjA, pszKey, szValA, sizeof(szValA));
    15111625    if (RT_SUCCESS(rc))
    15121626    {
    15131627        char szValB[_1K];
    1514         rc = audioTestGetValueStr(pVerify->pSetB, phObj, pszKey, szValB, sizeof(szValB));
     1628        rc = audioTestObjGetStr(phObjB, pszKey, szValB, sizeof(szValB));
    15151629        if (RT_SUCCESS(rc))
    15161630        {
     
    15421656 * @returns VBox status code.
    15431657 * @param   pSet                Audio test set the object contains.
    1544  * @param   pszUUID             UUID of object to open.
     1658 * @param   phObj               Object handle to open.
    15451659 * @param   ppObj               Where to return the pointer of the allocated and registered audio test object.
    15461660 */
    1547 static int audioTestSetObjOpen(PAUDIOTESTSET pSet, const char *pszUUID, PAUDIOTESTOBJ *ppObj)
    1548 {
    1549     AUDIOTESTOBJHANDLE hSec;
    1550     if (RTStrPrintf2(hSec.szSec, sizeof(hSec.szSec), "obj_%s", pszUUID) <= 0)
    1551         AssertFailedReturn(VERR_BUFFER_OVERFLOW);
    1552 
     1661static int audioTestSetObjOpen(PAUDIOTESTOBJHANDLE phObj, PAUDIOTESTOBJ *ppObj)
     1662{
    15531663    PAUDIOTESTOBJ pObj = (PAUDIOTESTOBJ)RTMemAlloc(sizeof(AUDIOTESTOBJ));
    15541664    AssertPtrReturn(pObj, VERR_NO_MEMORY);
    15551665
    1556     char szFileName[128];
    1557     int rc = audioTestGetValueStr(pSet, &hSec, "obj_name", szFileName, sizeof(szFileName));
     1666    char szFileName[AUDIOTEST_MAX_SEC_LEN];
     1667    int rc = audioTestObjGetStr(phObj, "obj_name", szFileName, sizeof(szFileName));
    15581668    if (RT_SUCCESS(rc))
    15591669    {
    15601670        char szFilePath[RTPATH_MAX];
    1561         rc = RTPathJoin(szFilePath, sizeof(szFilePath), pSet->szPathAbs, szFileName);
     1671        rc = RTPathJoin(szFilePath, sizeof(szFilePath), phObj->pSet->szPathAbs, szFileName);
    15621672        if (RT_SUCCESS(rc))
    15631673        {
     1674            /** @todo Check "obj_type". */
     1675
    15641676            rc = RTFileOpen(&pObj->File.hFile, szFilePath, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    15651677            if (RT_SUCCESS(rc))
     
    15711683                pObj->cRefs   = 1; /* Currently only 1:1 mapping. */
    15721684
    1573                 RTListAppend(&pSet->lstObj, &pObj->Node);
    1574                 pSet->cObj++;
     1685                RTListAppend(&phObj->pSet->lstObj, &pObj->Node);
     1686                phObj->pSet->cObj++;
    15751687
    15761688                *ppObj = pObj;
     
    16121724 * Finalizes an audio test set object.
    16131725 *
    1614  * @param   pObj                Object to finalize.
     1726 * @param   pObj                Test object to finalize.
    16151727 */
    16161728static void audioTestSetObjFinalize(PAUDIOTESTOBJ pObj)
     
    16211733    if (RTFileIsValid(pObj->File.hFile))
    16221734        pObj->File.cbSize = RTFileTell(pObj->File.hFile);
     1735}
     1736
     1737/**
     1738 * Retrieves tone PCM properties of an object.
     1739 *
     1740 * @returns VBox status code.
     1741 * @param   phObj               Object to retrieve PCM properties for.
     1742 * @param   pProps              Where to store the PCM properties on success.
     1743 */
     1744static int audioTestSetObjGetTonePcmProps(PAUDIOTESTOBJHANDLE phObj, PPDMAUDIOPCMPROPS pProps)
     1745{
     1746    int rc;
     1747
     1748    uint32_t uHz;
     1749    rc = audioTestObjGetUInt32(phObj, "tone_pcm_hz", &uHz);
     1750    AssertRCReturn(rc, rc);
     1751    uint8_t cBits;
     1752    rc = audioTestObjGetUInt8(phObj, "tone_pcm_bits", &cBits);
     1753    AssertRCReturn(rc, rc);
     1754    uint8_t cChan;
     1755    rc = audioTestObjGetUInt8(phObj, "tone_pcm_channels", &cChan);
     1756    AssertRCReturn(rc, rc);
     1757    bool    fSigned;
     1758    rc = audioTestObjGetBool(phObj, "tone_pcm_is_signed", &fSigned);
     1759    AssertRCReturn(rc, rc);
     1760
     1761    PDMAudioPropsInit(pProps, (cBits / 8), fSigned, cChan, uHz);
     1762
     1763    return VINF_SUCCESS;
    16231764}
    16241765
     
    16801821        if (!a_pVerJob->fKeepGoing) \
    16811822            return VINF_SUCCESS; \
    1682     }
    16831823
    16841824/**
     
    16871827 * @returns VBox status code.
    16881828 * @param   pVerJob             Verification job to verify PCM data for.
    1689  * @param   phTest              Test handle of test to verify PCM data for.
    1690  */
    1691 static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerJob, PAUDIOTESTOBJHANDLE phTest)
     1829 * @param   phTestA             Test handle A of test to verify PCM data for.
     1830 * @param   phTestB             Test handle B of test to verify PCM data for.
     1831 */
     1832static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerJob, PAUDIOTESTOBJHANDLE phTestA, PAUDIOTESTOBJHANDLE phTestB)
    16921833{
    16931834    int rc;
     
    16951836    /** @todo For now ASSUME that we only have one object per test. */
    16961837
    1697     char szObjA[128];
    1698     rc = audioTestGetValueStr(pVerJob->pSetA, phTest, "obj0_uuid", szObjA, sizeof(szObjA));
     1838    AUDIOTESTOBJHANDLE hObjA;
     1839
     1840    rc = audioTestSetGetObj(phTestA, 0 /* idxObj */, &hObjA);
     1841    CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to get object A");
     1842
    16991843    PAUDIOTESTOBJ pObjA;
    1700     rc = audioTestSetObjOpen(pVerJob->pSetA, szObjA, &pObjA);
    1701     CHECK_RC_MSG_VA_MAYBE_RET(rc, pVerJob, "Unable to open object A '%s'", szObjA);
    1702 
    1703     char szObjB[128];
    1704     rc = audioTestGetValueStr(pVerJob->pSetB, phTest, "obj0_uuid", szObjB, sizeof(szObjB));
     1844    rc = audioTestSetObjOpen(&hObjA, &pObjA);
     1845    CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to open object A");
     1846
     1847    AUDIOTESTOBJHANDLE hObjB;
     1848    rc = audioTestSetGetObj(phTestB, 0 /* idxObj */, &hObjB);
     1849    CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to get object B");
     1850
    17051851    PAUDIOTESTOBJ pObjB;
    1706     rc = audioTestSetObjOpen(pVerJob->pSetB, szObjB, &pObjB);
    1707     CHECK_RC_MSG_VA_MAYBE_RET(rc, pVerJob, "Unable to open object B '%s'", szObjB);
     1852    rc = audioTestSetObjOpen(&hObjB, &pObjB);
     1853    CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Unable to open object B");
    17081854    AssertReturn(pObjA->enmType == AUDIOTESTOBJTYPE_FILE, VERR_NOT_SUPPORTED);
    17091855    AssertReturn(pObjB->enmType == AUDIOTESTOBJTYPE_FILE, VERR_NOT_SUPPORTED);
     
    17321878    if (cbSizeA != cbSizeB)
    17331879    {
    1734         int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes %s than '%s'",
    1735                                             pObjA->szName,
    1736                                             cbSizeA > cbSizeB ? cbSizeA - cbSizeB : cbSizeB - cbSizeA,
    1737                                             cbSizeA > cbSizeB ? "bigger" : "smaller",
    1738                                             pObjB->szName);
     1880        size_t const cbDiffAbs = cbSizeA > cbSizeB ? cbSizeA - cbSizeB : cbSizeB - cbSizeA;
     1881
     1882        int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes (%zums)",
     1883                                            pObjA->szName, cbSizeA, PDMAudioPropsBytesToMilli(&pVerJob->PCMProps, cbSizeA));
     1884        AssertRC(rc2);
     1885        rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %zu bytes (%zums)",
     1886                                        pObjB->szName, cbSizeB, PDMAudioPropsBytesToMilli(&pVerJob->PCMProps, cbSizeB));
     1887        AssertRC(rc2);
     1888
     1889        rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "File '%s' is %u%% (%zu bytes, %zums) %s than '%s'",
     1890                                        pObjA->szName,
     1891                                        cbSizeA > cbSizeB ? 100 - ((cbSizeB * 100) / cbSizeA) : 100 - ((cbSizeA * 100) / cbSizeB),
     1892                                        cbDiffAbs, PDMAudioPropsBytesToMilli(&pVerJob->PCMProps, cbDiffAbs),
     1893                                        cbSizeA > cbSizeB ? "bigger" : "smaller",
     1894                                        pObjB->szName);
    17391895        AssertRC(rc2);
    17401896    }
     
    17641920 * @retval  VERR_
    17651921 * @param   pVerify             Verification job to verify test tone for.
    1766  * @param   phTest              Test handle of test tone to verify.
    1767  * @param   pSetPlay            Test set which did the playing part.
    1768  * @param   pSetRecord          Test set which did the recording part.
    1769  */
    1770 static int audioTestVerifyTestTone(PAUDIOTESTVERIFYJOB pVerify, PAUDIOTESTOBJHANDLE phTest, PAUDIOTESTSET pSetPlay, PAUDIOTESTSET pSetRecord)
    1771 {
    1772     RT_NOREF(pSetPlay, pSetRecord);
    1773 
     1922 * @param   phTestA             Test handle of test tone A to verify tone B with.
     1923 * @param   phTestB             Test handle of test tone B to verify tone A with.*
     1924 */
     1925static int audioTestVerifyTestTone(PAUDIOTESTVERIFYJOB pVerify, PAUDIOTESTOBJHANDLE phTestA, PAUDIOTESTOBJHANDLE phTestB)
     1926{
    17741927    int rc;
    17751928
     
    17781931     * More important items have precedence.
    17791932     */
    1780     rc = audioTestVerifyValue(pVerify, phTest, "error_rc", "0", "Test was reported as failed");
     1933    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "error_rc", "0", "Test was reported as failed");
    17811934    CHECK_RC_MAYBE_RET(rc, pVerify);
    1782     rc = audioTestVerifyValue(pVerify, phTest, "obj_count", NULL, "Object counts don't match");
     1935    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "obj_count", NULL, "Object counts don't match");
    17831936    CHECK_RC_MAYBE_RET(rc, pVerify);
    1784     rc = audioTestVerifyValue(pVerify, phTest, "tone_freq_hz", NULL, "Tone frequency doesn't match");
     1937    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_freq_hz", NULL, "Tone frequency doesn't match");
    17851938    CHECK_RC_MAYBE_RET(rc, pVerify);
    1786     rc = audioTestVerifyValue(pVerify, phTest, "tone_prequel_ms", NULL, "Tone prequel (ms) doesn't match");
     1939    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_prequel_ms", NULL, "Tone prequel (ms) doesn't match");
    17871940    CHECK_RC_MAYBE_RET(rc, pVerify);
    1788     rc = audioTestVerifyValue(pVerify, phTest, "tone_duration_ms", NULL, "Tone duration (ms) doesn't match");
     1941    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_duration_ms", NULL, "Tone duration (ms) doesn't match");
    17891942    CHECK_RC_MAYBE_RET(rc, pVerify);
    1790     rc = audioTestVerifyValue(pVerify, phTest, "tone_sequel_ms", NULL, "Tone sequel (ms) doesn't match");
     1943    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_sequel_ms", NULL, "Tone sequel (ms) doesn't match");
    17911944    CHECK_RC_MAYBE_RET(rc, pVerify);
    1792     rc = audioTestVerifyValue(pVerify, phTest, "tone_volume_percent", NULL, "Tone volume (percent) doesn't match");
     1945    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_volume_percent", NULL, "Tone volume (percent) doesn't match");
    17931946    CHECK_RC_MAYBE_RET(rc, pVerify);
    1794     rc = audioTestVerifyValue(pVerify, phTest, "tone_pcm_hz", NULL, "Tone PCM Hz doesn't match");
     1947    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_pcm_hz", NULL, "Tone PCM Hz doesn't match");
    17951948    CHECK_RC_MAYBE_RET(rc, pVerify);
    1796     rc = audioTestVerifyValue(pVerify, phTest, "tone_pcm_channels", NULL, "Tone PCM channels don't match");
     1949    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_pcm_channels", NULL, "Tone PCM channels don't match");
    17971950    CHECK_RC_MAYBE_RET(rc, pVerify);
    1798     rc = audioTestVerifyValue(pVerify, phTest, "tone_pcm_bits", NULL, "Tone PCM bits don't match");
     1951    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_pcm_bits", NULL, "Tone PCM bits don't match");
    17991952    CHECK_RC_MAYBE_RET(rc, pVerify);
    1800     rc = audioTestVerifyValue(pVerify, phTest, "tone_pcm_is_signed", NULL, "Tone PCM signed bit doesn't match");
     1953    rc = audioTestVerifyValue(pVerify, phTestA, phTestB, "tone_pcm_is_signed", NULL, "Tone PCM signed bit doesn't match");
     1954    CHECK_RC_MAYBE_RET(rc, pVerify);
     1955
     1956    rc = audioTestSetObjGetTonePcmProps(phTestA, &pVerify->PCMProps);
    18011957    CHECK_RC_MAYBE_RET(rc, pVerify);
    18021958
     
    18041960     * Now the fun stuff, PCM data analysis.
    18051961     */
    1806     rc = audioTestVerifyTestToneData(pVerify, phTest);
     1962    rc = audioTestVerifyTestToneData(pVerify, phTestA, phTestB);
    18071963    if (RT_FAILURE(rc))
    18081964    {
     
    18472003     * Compare obvious values first.
    18482004     */
    1849     AUDIOTESTOBJHANDLE hHdr;
    1850     RTStrPrintf(hHdr.szSec, sizeof(hHdr.szSec), "header");
    1851 
    1852     rc = audioTestVerifyValue(&VerJob, &hHdr,   "magic",        "vkat_ini",    "Manifest magic wrong");
     2005    AUDIOTESTOBJHANDLE hHdrA;
     2006    rc = audioTestSetGetSection(pVerJob->pSetA, AUDIOTEST_SEC_HDR_STR, &hHdrA);
    18532007    CHECK_RC_MAYBE_RET(rc, pVerJob);
    1854     rc = audioTestVerifyValue(&VerJob, &hHdr,   "ver",          "1"       ,    "Manifest version wrong");
     2008
     2009    AUDIOTESTOBJHANDLE hHdrB;
     2010    rc = audioTestSetGetSection(pVerJob->pSetB, AUDIOTEST_SEC_HDR_STR, &hHdrB);
    18552011    CHECK_RC_MAYBE_RET(rc, pVerJob);
    1856     rc = audioTestVerifyValue(&VerJob, &hHdr,   "tag",          NULL,          "Manifest tags don't match");
     2012
     2013    rc = audioTestVerifyValue(&VerJob, &hHdrA, &hHdrB,   "magic",        "vkat_ini",    "Manifest magic wrong");
    18572014    CHECK_RC_MAYBE_RET(rc, pVerJob);
    1858     rc = audioTestVerifyValue(&VerJob, &hHdr,   "test_count",   NULL,          "Test counts don't match");
     2015    rc = audioTestVerifyValue(&VerJob, &hHdrB, &hHdrB,   "ver",          "1"       ,    "Manifest version wrong");
    18592016    CHECK_RC_MAYBE_RET(rc, pVerJob);
    1860     rc = audioTestVerifyValue(&VerJob, &hHdr,   "obj_count",    NULL,          "Object counts don't match");
     2017    rc = audioTestVerifyValue(&VerJob, &hHdrB, &hHdrB,   "tag",          NULL,          "Manifest tags don't match");
     2018    CHECK_RC_MAYBE_RET(rc, pVerJob);
     2019    rc = audioTestVerifyValue(&VerJob, &hHdrB, &hHdrB,   "test_count",   NULL,          "Test counts don't match");
     2020    CHECK_RC_MAYBE_RET(rc, pVerJob);
     2021    rc = audioTestVerifyValue(&VerJob, &hHdrB, &hHdrB,   "obj_count",    NULL,          "Object counts don't match");
    18612022    CHECK_RC_MAYBE_RET(rc, pVerJob);
    18622023
     
    18652026     */
    18662027    uint32_t cTests;
    1867     rc = audioTestGetValueUInt32(VerJob.pSetA, &hHdr, "test_count", &cTests);
     2028    rc = audioTestObjGetUInt32(&hHdrA, "test_count", &cTests);
    18682029    AssertRCReturn(rc, rc);
    18692030
     
    18722033        VerJob.idxTest = i;
    18732034
    1874         AUDIOTESTOBJHANDLE hTest; /** @todo r=bird: This is not a handle if you RTStrPrintf to its members. A handle doesn't have members, it's opque. */
    1875         RTStrPrintf(hTest.szSec, sizeof(hTest.szSec), "test_%04RU32", i);
     2035        AUDIOTESTOBJHANDLE hTestA;
     2036        rc = audioTestSetGetTest(VerJob.pSetA, i, &hTestA);
     2037        CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test A not found");
     2038
     2039        AUDIOTESTOBJHANDLE hTestB;
     2040        rc = audioTestSetGetTest(VerJob.pSetB, i, &hTestB);
     2041        CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test B not found");
    18762042
    18772043        AUDIOTESTTYPE enmTestTypeA = AUDIOTESTTYPE_INVALID;
    1878         rc = audioTestGetValueUInt32(VerJob.pSetA, &hTest, "test_type", (uint32_t *)&enmTestTypeA);
     2044        rc = audioTestObjGetUInt32(&hTestA, "test_type", (uint32_t *)&enmTestTypeA);
    18792045        CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test type A not found");
    18802046
    18812047        AUDIOTESTTYPE enmTestTypeB = AUDIOTESTTYPE_INVALID;
    1882         rc = audioTestGetValueUInt32(VerJob.pSetB, &hTest, "test_type", (uint32_t *)&enmTestTypeB);
     2048        rc = audioTestObjGetUInt32(&hTestB, "test_type", (uint32_t *)&enmTestTypeB);
    18832049        CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test type B not found");
    18842050
     
    18882054            {
    18892055                if (enmTestTypeB == AUDIOTESTTYPE_TESTTONE_RECORD)
    1890                     rc = audioTestVerifyTestTone(&VerJob, &hTest, VerJob.pSetA, VerJob.pSetB);
     2056                    rc = audioTestVerifyTestTone(&VerJob, &hTestA, &hTestB);
    18912057                else
    18922058                    rc = audioTestErrorDescAddError(pErrDesc, i, "Playback test types don't match (set A=%#x, set B=%#x)",
     
    18982064            {
    18992065                if (enmTestTypeB == AUDIOTESTTYPE_TESTTONE_PLAY)
    1900                     rc = audioTestVerifyTestTone(&VerJob, &hTest, VerJob.pSetB, VerJob.pSetA);
     2066                    rc = audioTestVerifyTestTone(&VerJob, &hTestB, &hTestA);
    19012067                else
    19022068                    rc = audioTestErrorDescAddError(pErrDesc, i, "Recording test types don't match (set A=%#x, set B=%#x)",
  • trunk/src/VBox/Devices/Audio/AudioTest.h

    r89890 r89984  
    218218    /** List node. */
    219219    RTLISTNODE           Node;
     220    /** The UUID of the object.
     221     *  Used to identify an object within a test set. */
    220222    RTUUID               Uuid;
    221223    /** Number of references to this test object. */
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