VirtualBox

Changeset 91655 in vbox


Ignore:
Timestamp:
Oct 10, 2021 8:34:33 AM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: A bit more code for the audio data beacons. ​bugref:10008

Location:
trunk/src/VBox
Files:
3 edited

Legend:

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

    r91632 r91655  
    3232/** Prefix for audio test (set) directories. */
    3333#define AUDIOTEST_PATH_PREFIX_STR       "vkat"
     34/** Audio beacon data (single byte) to use for the post beacon (intro). */
     35#define AUDIOTEST_BEACON_BYTE_PRE       0x42
     36/** Audio beacon data (single byte) to use for the post beacon (outro). */
     37#define AUDIOTEST_BEACON_BYTE_POST      0x24
     38/** Pre / post audio beacon size (in audio frames). */
     39#define AUDIOTEST_BEACON_SIZE_FRAMES    1024
    3440
    3541/**
  • trunk/src/VBox/Devices/Audio/DrvHostAudioValidationKit.cpp

    r91648 r91655  
    312312    Assert(pThis->cTestsRec == 0);
    313313    Assert(pThis->cTestsPlay == 0);
     314
     315    if (pThis->cbPlayedNoTest)
     316    {
     317        LogRel2(("ValKit: Warning: Guest was playing back audio when no playback test is active (%RU64 bytes total)\n",
     318                 pThis->cbPlayedNoTest));
     319        pThis->cbPlayedNoTest = 0;
     320    }
    314321}
    315322
     
    517524    AssertReturn(PDMAudioPropsAreValid(&pTestData->t.TestTone.Parms.Props), VERR_INVALID_PARAMETER);
    518525
    519     pTestData->t.TestTone.u.Play.cbToRead = PDMAudioPropsMilliToBytes(&pTestData->t.TestTone.Parms.Props,
    520                                                                       pTestData->t.TestTone.Parms.msDuration);
     526    pTestData->t.TestTone.u.Play.cbToRead  = PDMAudioPropsMilliToBytes(&pTestData->t.TestTone.Parms.Props,
     527                                                                       pTestData->t.TestTone.Parms.msDuration);
     528    uint32_t const cbBeacons = PDMAudioPropsFramesToBytes(&pTestData->t.TestTone.Parms.Props,
     529                                                          AUDIOTEST_BEACON_SIZE_FRAMES * 2 /* Pre + post beacon */);
     530    pTestData->t.TestTone.u.Play.cbToRead += cbBeacons;
     531
    521532    int rc = RTCritSectEnter(&pThis->CritSect);
    522533    if (RT_SUCCESS(rc))
     
    921932    if (pTst == NULL) /* Empty list? */
    922933    {
    923         LogRel2(("ValKit: Warning: Guest is playing back audio when no playback test is active\n"));
    924 
    925934        pThis->cbPlayedNoTest += cbBuf;
    926935
     
    931940    if (pThis->cbPlayedNoTest)
    932941    {
    933         LogRel(("ValKit: Warning: Guest was playing back audio (%RU32 bytes, %RU64ms) when no playback test is active\n",
     942        LogRel(("ValKit: Warning: Guest was playing back audio (%RU64 bytes, %RU64ms) when no playback test is active\n",
    934943                pThis->cbPlayedNoTest, PDMAudioPropsBytesToMilli(&pStream->pStream->Cfg.Props, pThis->cbPlayedNoTest)));
    935944        pThis->cbPlayedNoTest = 0;
     
    943952    {
    944953        if (pThis->cbPlayedSilence)
    945             LogRel(("ValKit: Guest was playing back %RU32 bytes (%RU64ms) of silence\n",
     954            LogRel(("ValKit: Guest was playing back %RU64 bytes (%RU64ms) of silence\n",
    946955                    pThis->cbPlayedSilence, PDMAudioPropsBytesToMilli(&pStream->pStream->Cfg.Props, pThis->cbPlayedSilence)));
    947956        pThis->cbPlayedSilence = 0;
  • trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp

    r91644 r91655  
    524524        uint32_t cbPlayedTotal  = 0;
    525525
    526         /* We play a pre + post beacon before + after the actual test tone with exactly 1024 audio frames. */
    527         uint32_t const cbBeacon       = PDMAudioPropsFramesToBytes(&pStream->Cfg.Props, 1024);
     526        /* We play a pre + post beacon before + after the actual test tone
     527         * with exactly AUDIOTEST_BEACON_SIZE_FRAMES audio frames. */
     528        uint32_t const cbBeacon       = PDMAudioPropsFramesToBytes(&pStream->Cfg.Props, AUDIOTEST_BEACON_SIZE_FRAMES);
    528529        uint32_t       cbBeaconToPlay = cbBeacon;
    529530        uint32_t       cbBeaconPlayed = 0;
     
    588589                    /* Limit to exactly one beacon (pre or post). */
    589590                    cbToPlay = RT_MIN(sizeof(abBuf), RT_MIN(cbCanWrite, cbBeaconToPlay - cbBeaconPlayed));
    590                     memset(abBuf, 0x42 /* Our actual beacon data, hopefully the answer to all ... */, cbToPlay);
     591                    memset(abBuf,
     592                           cbPlayedTotal >= cbToPlayTotal - cbBeaconToPlay ? AUDIOTEST_BEACON_BYTE_POST : AUDIOTEST_BEACON_BYTE_PRE,
     593                           cbToPlay);
    591594
    592595                    rc = AudioTestMixStreamPlay(&pStream->Mix, abBuf, cbToPlay, &cbPlayed);
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