VirtualBox

Changeset 92234 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Nov 5, 2021 8:44:14 AM (3 years ago)
Author:
vboxsync
Message:

Audio/Validation Kit: More code for audio data beacon handling. Now has dedicated beacons for recording / playback tests. bugref:10008

File:
1 edited

Legend:

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

    r92211 r92234  
    803803                    cbRecTotal += cbRecorded; /* Do a bit of accounting. */
    804804
    805                     /* Always write (record) everything, no matter if the current audio contains complete silence or not.
    806                      * Might be also become handy later if we want to have a look at start/stop timings and so on. */
    807                     rc = AudioTestObjWrite(Obj, abSamples, cbRecorded);
    808                     AssertRCBreak(rc);
    809 
    810805                    switch (enmState)
    811806                    {
     
    819814                                bool const fStarted = AudioTestBeaconGetRemaining(&Beacon) == AudioTestBeaconGetSize(&Beacon);
    820815
    821                                 /* Limit adding data to the beacon size. */
    822                                 uint32_t const cbToAddMax = RT_MIN(cbRecorded, AudioTestBeaconGetRemaining(&Beacon));
    823 
    824                                 AudioTestBeaconAddConsecutive(&Beacon, abSamples, cbToAddMax);
    825                                 /** @todo Take left-over data into account (and stash them away for the test tone)? */
     816                                size_t uOff;
     817                                rc = AudioTestBeaconAddConsecutive(&Beacon, abSamples, cbRecorded, &uOff);
     818                                if (RT_SUCCESS(rc))
     819                                {
     820                                    /*
     821                                     * When being in the AUDIOTESTSTATE_PRE state, we might get more audio data
     822                                     * than we need for the pre-beacon to complete. In other words, that "more data"
     823                                     * needs to be counted to the actual recorded test tone data then.
     824                                     */
     825                                    if (enmState == AUDIOTESTSTATE_PRE)
     826                                        cbTestRec += cbRecorded - (uint32_t)uOff;
     827                                }
    826828
    827829                                if (   fStarted
     
    852854                             * Currently we don't, as otherwise consequtively played tones will be cut off in the end. */
    853855                            if (!fIsAllSilence)
     856                            {
     857                                uint32_t const cbToAddMax = cbTestToRec - cbTestRec;
     858
     859                                /* Don't read more than we're told to.
     860                                 * After the actual test tone data there might come a post beacon which also
     861                                 * needs to be handled in the AUDIOTESTSTATE_POST state then. */
     862                                if (cbRecorded > cbToAddMax)
     863                                    cbRecorded = cbToAddMax;
     864
    854865                                cbTestRec += cbRecorded;
     866                            }
    855867
    856868                            if (cbTestToRec - cbTestRec == 0) /* Done recording the test tone? */
     
    874886                }
    875887
    876                 if (enmState == AUDIOTESTSTATE_DONE)
     888                if (cbRecorded)
     889                {
     890                    /* Always write (record) everything, no matter if the current audio contains complete silence or not.
     891                     * Might be also become handy later if we want to have a look at start/stop timings and so on. */
     892                    rc = AudioTestObjWrite(Obj, abSamples, cbRecorded);
     893                    AssertRCBreak(rc);
     894                }
     895
     896                if (enmState == AUDIOTESTSTATE_DONE) /* Bail out when in state "done". */
    877897                    break;
    878898            }
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