Changeset 89984 in vbox
- Timestamp:
- Jul 1, 2021 8:36:56 AM (4 years ago)
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioTest.cpp
r89966 r89984 64 64 65 65 /** 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 67 71 68 72 … … 72 76 /** 73 77 * 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.76 78 */ 77 79 typedef struct AUDIOTESTOBJHANDLE 78 80 { 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]; 80 86 } AUDIOTESTOBJHANDLE; 81 87 /** Pointer to an audio test object handle. */ … … 97 103 /** Flag indicating whether to keep going after an error has occurred. */ 98 104 bool fKeepGoing; 105 /** PCM properties to use for verification. */ 106 PDMAUDIOPCMPROPS PCMProps; 99 107 } AUDIOTESTVERIFYJOB; 100 108 /** Pointer to an audio test verification job. */ … … 687 695 688 696 /** 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 */ 705 static 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 */ 720 static 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 */ 738 static 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 */ 756 static 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 /** 689 767 * Returns the absolute path of a given audio test set object. 690 768 * … … 960 1038 rc = audioTestManifestWrite(pSet, "\n"); 961 1039 AssertRCReturn(rc, rc); 962 char szUuid[ 64];1040 char szUuid[AUDIOTEST_MAX_SEC_LEN]; 963 1041 rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid)); 964 1042 AssertRCReturn(rc, rc); … … 1095 1173 rc = RTUuidCreate(&pObj->Uuid); 1096 1174 AssertRCReturn(rc, rc); 1097 char szUuid[ 64];1175 char szUuid[AUDIOTEST_MAX_OBJ_LEN]; 1098 1176 rc = RTUuidToStr(&pObj->Uuid, szUuid, sizeof(szUuid)); 1099 1177 AssertRCReturn(rc, rc); … … 1454 1532 1455 1533 /** 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 */ 1544 static 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 */ 1566 static 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 */ 1583 static 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)); 1485 1591 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 } 1487 1600 1488 1601 return rc; … … 1495 1608 * @returns Error if the verification failed and test verification job has fKeepGoing not set. 1496 1609 * @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. 1498 1612 * @param pszKey Key to verify. 1499 1613 * @param pszVal Value to verify. … … 1502 1616 */ 1503 1617 static 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, ...) 1505 1619 { 1506 1620 va_list va; … … 1508 1622 1509 1623 char szValA[_1K]; 1510 int rc = audioTest GetValueStr(pVerify->pSetA, phObj, pszKey, szValA, sizeof(szValA));1624 int rc = audioTestObjGetStr(phObjA, pszKey, szValA, sizeof(szValA)); 1511 1625 if (RT_SUCCESS(rc)) 1512 1626 { 1513 1627 char szValB[_1K]; 1514 rc = audioTest GetValueStr(pVerify->pSetB, phObj, pszKey, szValB, sizeof(szValB));1628 rc = audioTestObjGetStr(phObjB, pszKey, szValB, sizeof(szValB)); 1515 1629 if (RT_SUCCESS(rc)) 1516 1630 { … … 1542 1656 * @returns VBox status code. 1543 1657 * @param pSet Audio test set the object contains. 1544 * @param p szUUID UUID of objectto open.1658 * @param phObj Object handle to open. 1545 1659 * @param ppObj Where to return the pointer of the allocated and registered audio test object. 1546 1660 */ 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 1661 static int audioTestSetObjOpen(PAUDIOTESTOBJHANDLE phObj, PAUDIOTESTOBJ *ppObj) 1662 { 1553 1663 PAUDIOTESTOBJ pObj = (PAUDIOTESTOBJ)RTMemAlloc(sizeof(AUDIOTESTOBJ)); 1554 1664 AssertPtrReturn(pObj, VERR_NO_MEMORY); 1555 1665 1556 char szFileName[ 128];1557 int rc = audioTest GetValueStr(pSet, &hSec, "obj_name", szFileName, sizeof(szFileName));1666 char szFileName[AUDIOTEST_MAX_SEC_LEN]; 1667 int rc = audioTestObjGetStr(phObj, "obj_name", szFileName, sizeof(szFileName)); 1558 1668 if (RT_SUCCESS(rc)) 1559 1669 { 1560 1670 char szFilePath[RTPATH_MAX]; 1561 rc = RTPathJoin(szFilePath, sizeof(szFilePath), p Set->szPathAbs, szFileName);1671 rc = RTPathJoin(szFilePath, sizeof(szFilePath), phObj->pSet->szPathAbs, szFileName); 1562 1672 if (RT_SUCCESS(rc)) 1563 1673 { 1674 /** @todo Check "obj_type". */ 1675 1564 1676 rc = RTFileOpen(&pObj->File.hFile, szFilePath, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 1565 1677 if (RT_SUCCESS(rc)) … … 1571 1683 pObj->cRefs = 1; /* Currently only 1:1 mapping. */ 1572 1684 1573 RTListAppend(&p Set->lstObj, &pObj->Node);1574 p Set->cObj++;1685 RTListAppend(&phObj->pSet->lstObj, &pObj->Node); 1686 phObj->pSet->cObj++; 1575 1687 1576 1688 *ppObj = pObj; … … 1612 1724 * Finalizes an audio test set object. 1613 1725 * 1614 * @param pObj Object to finalize.1726 * @param pObj Test object to finalize. 1615 1727 */ 1616 1728 static void audioTestSetObjFinalize(PAUDIOTESTOBJ pObj) … … 1621 1733 if (RTFileIsValid(pObj->File.hFile)) 1622 1734 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 */ 1744 static 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; 1623 1764 } 1624 1765 … … 1680 1821 if (!a_pVerJob->fKeepGoing) \ 1681 1822 return VINF_SUCCESS; \ 1682 }1683 1823 1684 1824 /** … … 1687 1827 * @returns VBox status code. 1688 1828 * @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 */ 1832 static int audioTestVerifyTestToneData(PAUDIOTESTVERIFYJOB pVerJob, PAUDIOTESTOBJHANDLE phTestA, PAUDIOTESTOBJHANDLE phTestB) 1692 1833 { 1693 1834 int rc; … … 1695 1836 /** @todo For now ASSUME that we only have one object per test. */ 1696 1837 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 1699 1843 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 1705 1851 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"); 1708 1854 AssertReturn(pObjA->enmType == AUDIOTESTOBJTYPE_FILE, VERR_NOT_SUPPORTED); 1709 1855 AssertReturn(pObjB->enmType == AUDIOTESTOBJTYPE_FILE, VERR_NOT_SUPPORTED); … … 1732 1878 if (cbSizeA != cbSizeB) 1733 1879 { 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); 1739 1895 AssertRC(rc2); 1740 1896 } … … 1764 1920 * @retval VERR_ 1765 1921 * @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 */ 1925 static int audioTestVerifyTestTone(PAUDIOTESTVERIFYJOB pVerify, PAUDIOTESTOBJHANDLE phTestA, PAUDIOTESTOBJHANDLE phTestB) 1926 { 1774 1927 int rc; 1775 1928 … … 1778 1931 * More important items have precedence. 1779 1932 */ 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"); 1781 1934 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"); 1783 1936 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"); 1785 1938 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"); 1787 1940 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"); 1789 1942 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"); 1791 1944 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"); 1793 1946 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"); 1795 1948 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"); 1797 1950 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"); 1799 1952 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); 1801 1957 CHECK_RC_MAYBE_RET(rc, pVerify); 1802 1958 … … 1804 1960 * Now the fun stuff, PCM data analysis. 1805 1961 */ 1806 rc = audioTestVerifyTestToneData(pVerify, phTest );1962 rc = audioTestVerifyTestToneData(pVerify, phTestA, phTestB); 1807 1963 if (RT_FAILURE(rc)) 1808 1964 { … … 1847 2003 * Compare obvious values first. 1848 2004 */ 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); 1853 2007 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); 1855 2011 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"); 1857 2014 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"); 1859 2016 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"); 1861 2022 CHECK_RC_MAYBE_RET(rc, pVerJob); 1862 2023 … … 1865 2026 */ 1866 2027 uint32_t cTests; 1867 rc = audioTest GetValueUInt32(VerJob.pSetA, &hHdr, "test_count", &cTests);2028 rc = audioTestObjGetUInt32(&hHdrA, "test_count", &cTests); 1868 2029 AssertRCReturn(rc, rc); 1869 2030 … … 1872 2033 VerJob.idxTest = i; 1873 2034 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"); 1876 2042 1877 2043 AUDIOTESTTYPE enmTestTypeA = AUDIOTESTTYPE_INVALID; 1878 rc = audioTest GetValueUInt32(VerJob.pSetA, &hTest, "test_type", (uint32_t *)&enmTestTypeA);2044 rc = audioTestObjGetUInt32(&hTestA, "test_type", (uint32_t *)&enmTestTypeA); 1879 2045 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test type A not found"); 1880 2046 1881 2047 AUDIOTESTTYPE enmTestTypeB = AUDIOTESTTYPE_INVALID; 1882 rc = audioTest GetValueUInt32(VerJob.pSetB, &hTest, "test_type", (uint32_t *)&enmTestTypeB);2048 rc = audioTestObjGetUInt32(&hTestB, "test_type", (uint32_t *)&enmTestTypeB); 1883 2049 CHECK_RC_MSG_MAYBE_RET(rc, pVerJob, "Test type B not found"); 1884 2050 … … 1888 2054 { 1889 2055 if (enmTestTypeB == AUDIOTESTTYPE_TESTTONE_RECORD) 1890 rc = audioTestVerifyTestTone(&VerJob, &hTest , VerJob.pSetA, VerJob.pSetB);2056 rc = audioTestVerifyTestTone(&VerJob, &hTestA, &hTestB); 1891 2057 else 1892 2058 rc = audioTestErrorDescAddError(pErrDesc, i, "Playback test types don't match (set A=%#x, set B=%#x)", … … 1898 2064 { 1899 2065 if (enmTestTypeB == AUDIOTESTTYPE_TESTTONE_PLAY) 1900 rc = audioTestVerifyTestTone(&VerJob, &hTest , VerJob.pSetB, VerJob.pSetA);2066 rc = audioTestVerifyTestTone(&VerJob, &hTestB, &hTestA); 1901 2067 else 1902 2068 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 218 218 /** List node. */ 219 219 RTLISTNODE Node; 220 /** The UUID of the object. 221 * Used to identify an object within a test set. */ 220 222 RTUUID Uuid; 221 223 /** Number of references to this test object. */
Note:
See TracChangeset
for help on using the changeset viewer.