VirtualBox

Changeset 91643 in vbox


Ignore:
Timestamp:
Oct 8, 2021 2:16:17 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
147368
Message:

Audio/Validation Kit: Fixes for audioTestFilesFindDiffsBinary(). ​bugref:10008

File:
1 edited

Legend:

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

    r91641 r91643  
    22452245    uint32_t const cbChunkSize = PDMAudioPropsFrameSize(&pToneParms->Props); /* Use the audio frame size as chunk size. */
    22462246
    2247     uint64_t offCur      = 0;
    2248     uint64_t offLastDiff = UINT64_MAX;
    2249     uint64_t cbSize      = RT_MIN(pCmpA->cbSize, pCmpB->cbSize);
    2250     uint64_t cbToCompare = cbSize;
     2247    uint64_t offCur       = 0;
     2248    uint64_t offDiffStart = 0;
     2249    bool     fInDiff      = false;
     2250    uint64_t cbSize       = RT_MIN(pCmpA->cbSize, pCmpB->cbSize);
     2251    uint64_t cbToCompare  = cbSize;
    22512252
    22522253    while (cbToCompare)
     
    22622263        if (memcmp(auBufA, auBufB, RT_MIN(cbReadA, cbReadB)) != 0)
    22632264        {
    2264             if (offLastDiff == UINT64_MAX) /* No consequitive different chunk? Count as new then. */
     2265            if (!fInDiff) /* No consequitive different chunk? Count as new then. */
    22652266            {
    22662267                cDiffs++;
    2267                 offLastDiff = offCur;
     2268                offDiffStart = offCur;
     2269                fInDiff  = true;
    22682270            }
    22692271        }
    22702272        else /* Reset and count next difference as new then. */
    22712273        {
    2272             if (cDiffs)
     2274            if (fInDiff)
    22732275            {
    2274                 uint32_t const cbDiff = offCur - offLastDiff;
     2276                uint32_t const cbDiff = offCur - offDiffStart;
    22752277                int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Chunks differ: A @ %#x vs. B @ %#x [%08RU64-%08RU64] (%RU64 bytes, %RU64ms)",
    2276                                                                                      pCmpA->offStart, pCmpB->offStart, offLastDiff, offCur,
     2278                                                                                     pCmpA->offStart, pCmpB->offStart, offDiffStart, offCur,
    22772279                                                                                     cbDiff, PDMAudioPropsBytesToMilli(&pToneParms->Props, cbDiff));
    22782280                AssertRC(rc2);
     
    22802282                cbDiffs += cbDiff;
    22812283            }
    2282             offLastDiff = UINT64_MAX;
     2284            fInDiff = false;
    22832285        }
    22842286
     
    22892291
    22902292    /* If we didn't mention the last diff yet, do so now. */
    2291     if (   offLastDiff != UINT64_MAX
    2292         && cDiffs)
    2293     {
    2294         uint32_t const cbDiff = offCur - offLastDiff;
     2293    if (fInDiff)
     2294    {
     2295        uint32_t const cbDiff = offCur - offDiffStart;
    22952296        int rc2 = audioTestErrorDescAddInfo(pVerJob->pErr, pVerJob->idxTest, "Chunks differ: A @ %#x vs. B @ %#x [%08RU64-%08RU64] (%RU64 bytes, %RU64ms)",
    2296                                                                              pCmpA->offStart, pCmpB->offStart, offLastDiff, offCur,
     2297                                                                             pCmpA->offStart, pCmpB->offStart, offDiffStart, offCur,
    22972298                                                                             cbDiff, PDMAudioPropsBytesToMilli(&pToneParms->Props, cbDiff));
    22982299        AssertRC(rc2);
     
    23012302    }
    23022303
    2303     if (cbDiffs)
    2304     {
    2305         uint8_t const uDiffPercent = (cbSize * 100) / cbDiffs;
     2304    if (   cbSize
     2305        && cbDiffs)
     2306    {
     2307        uint8_t const uDiffPercent = cbDiffs / (cbSize * 100);
    23062308        if (uDiffPercent > pVerJob->Opts.uMaxDiffPercent)
    23072309        {
Note: See TracChangeset for help on using the changeset viewer.

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