VirtualBox

Changeset 91139 in vbox


Ignore:
Timestamp:
Sep 7, 2021 12:37:53 PM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: Some more diagnostics to find out why some testbox guests refuse to play any test tones. ​bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/utils/audio/vkatCommon.cpp

    r90978 r91139  
    265265        uint32_t cbToPlayTotal  = PDMAudioPropsMilliToBytes(&pStream->Cfg.Props, pParms->msDuration);
    266266        AssertStmt(cbToPlayTotal, rc = VERR_INVALID_PARAMETER);
     267        uint32_t cbPlayedTotal  = 0;
    267268
    268269        RTTestPrintf(g_hTest, RTTESTLVL_DEBUG, "Playing %RU32 bytes total\n", cbToPlayTotal);
     
    286287
    287288        uint64_t        offStream          = 0;
    288         uint64_t        tsStartMs          = RTTimeMilliTS();
    289         RTMSINTERVAL    uTimeoutMs         = pParms->msDuration * 4; /* Four times the time playback should roughly take */
     289        uint64_t        uTimeoutNs         = (pParms->msDuration * 4) * RT_NS_1MS; /* Four times the time playback should roughly take */
    290290
    291291        while (cbToPlayTotal)
     
    322322                        {
    323323                            offStream += cbPlayed;
     324
     325                            if (cbPlayed != cbToPlay)
     326                                RTTestFailed(g_hTest, "Only played %RU32/%RU32 bytes", cbPlayed, cbToPlay);
    324327                        }
    325328                    }
     
    334337                AssertFailedBreakStmt(rc = VERR_AUDIO_STREAM_NOT_READY);
    335338
    336             Assert(cbToPlayTotal >= cbPlayed);
    337             cbToPlayTotal -= cbPlayed;
     339            cbPlayedTotal += cbPlayed;
     340            AssertBreakStmt(cbPlayedTotal <= cbToPlayTotal, VERR_BUFFER_OVERFLOW);
    338341
    339342            /* Fail-safe in case something screwed up while playing back. */
    340             if (RTTimeMilliTS() - tsStartMs > uTimeoutMs)
     343            if (RTTimeNanoTS() - nsStarted > uTimeoutNs)
    341344            {
    342                 RTTestFailed(g_hTest, "Playback took too long (%RU32ms exceeded), aborting\n", uTimeoutMs);
     345                RTTestFailed(g_hTest, "Playback took too long (%RU32ms exceeded), aborting\n", uTimeoutNs / RT_NS_1MS);
    343346                rc = VERR_TIMEOUT;
     347            }
     348
     349            if (RT_FAILURE(rc))
    344350                break;
    345             }
    346         }
    347 
    348         if (cbToPlayTotal != 0)
    349             RTTestFailed(g_hTest, "Playback ended unexpectedly (%RU32 bytes left)\n", cbToPlayTotal);
     351        }
     352
     353        if (cbPlayedTotal != cbToPlayTotal)
     354            RTTestFailed(g_hTest, "Playback ended unexpectedly (%RU32/%RU32 played)\n", cbPlayedTotal, cbToPlayTotal);
    350355
    351356        if (RT_SUCCESS(rc))
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