VirtualBox

Changeset 75983 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Dec 5, 2018 4:35:32 PM (6 years ago)
Author:
vboxsync
Message:

Audio/HDA: Use a dedicated default value for the stream position adjustment (needed for resetting the stream).

Location:
trunk/src/VBox/Devices/Audio
Files:
2 edited

Legend:

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

    r75980 r75983  
    402402
    403403                /* Initialize position adjustment counter. */
    404                 pStream->State.cPosAdjustFramesLeft = cfPosAdjust;
    405                 LogRel2(("HDA: Position adjustment for stream #%RU8 active (%RU32 frames)\n", pStream->u8SD, cfPosAdjust));
     404                pStream->State.cfPosAdjustDefault = cfPosAdjust;
     405                pStream->State.cfPosAdjustLeft    = pStream->State.cfPosAdjustDefault;
     406
     407                LogRel2(("HDA: Position adjustment for stream #%RU8 active (%RU32 frames)\n",
     408                         pStream->u8SD, pStream->State.cfPosAdjustDefault));
    406409            }
    407410        }
     
    507510    pStream->pMixSink = hdaR3GetDefaultSink(pThis, uSD);
    508511
     512    /* Reset position adjustment counter. */
     513    pStream->State.cfPosAdjustLeft = pStream->State.cfPosAdjustDefault;
     514
    509515    /* Reset transfer stuff. */
    510516    pStream->State.cbTransferProcessed        = 0;
     
    963969        /* If there are position adjustment frames left to be processed,
    964970         * make sure that we process them first as a whole. */
    965         if (pStream->State.cPosAdjustFramesLeft)
    966             cbChunk = RT_MIN(cbChunk, uint32_t(pStream->State.cPosAdjustFramesLeft * pStream->State.Mapping.cbFrameSize));
     971        if (pStream->State.cfPosAdjustLeft)
     972            cbChunk = RT_MIN(cbChunk, uint32_t(pStream->State.cfPosAdjustLeft * pStream->State.Mapping.cbFrameSize));
    967973
    968974        Log3Func(("[SD%RU8] cbChunk=%RU32, cPosAdjustFramesLeft=%RU16\n",
    969                   pStream->u8SD, cbChunk, pStream->State.cPosAdjustFramesLeft));
     975                  pStream->u8SD, cbChunk, pStream->State.cfPosAdjustLeft));
    970976
    971977        if (!cbChunk)
     
    11681174            /* Are we done doing the position adjustment?
    11691175             * Only then do the transfer accounting .*/
    1170             if (pStream->State.cPosAdjustFramesLeft == 0)
     1176            if (pStream->State.cfPosAdjustLeft == 0)
    11711177            {
    11721178                Assert(cbLeft >= cbDMA);
     
    11991205                 *
    12001206                 * In such a case we need to skip such an interrupt and just move on. */
    1201                 && pStream->State.cPosAdjustFramesLeft == 0)
     1207                && pStream->State.cfPosAdjustLeft == 0)
    12021208            {
    12031209                /* If the IOCE ("Interrupt On Completion Enable") bit of the SDCTL register is set
     
    12261232
    12271233        /* Do the position adjustment accounting. */
    1228         pStream->State.cPosAdjustFramesLeft -=
    1229             RT_MIN(pStream->State.cPosAdjustFramesLeft, cbDMA / pStream->State.Mapping.cbFrameSize);
     1234        pStream->State.cfPosAdjustLeft -=
     1235            RT_MIN(pStream->State.cfPosAdjustLeft, cbDMA / pStream->State.Mapping.cbFrameSize);
    12301236
    12311237        if (RT_FAILURE(rc))
     
    12421248    /* Only do the data accounting if we don't have to do any position
    12431249     * adjustment anymore. */
    1244     if (pStream->State.cPosAdjustFramesLeft == 0)
     1250    if (pStream->State.cfPosAdjustLeft == 0)
    12451251    {
    12461252        hdaR3StreamPeriodInc(pPeriod, RT_MIN(cbProcessed / pStream->State.Mapping.cbFrameSize,
  • trunk/src/VBox/Devices/Audio/HDAStream.h

    r75962 r75983  
    151151    uint8_t                 cTransferPendingInterrupts;
    152152    uint8_t                 Padding2[4];
     153    /** Number of audio data frames for the position adjustment.
     154     *  0 if no position adjustment is needed. */
     155    uint16_t                cfPosAdjustDefault;
    153156    /** How many audio data frames are left to be processed
    154157     *  for the position adjustment handling.
    155158     *
    156159     *  0 if position adjustment handling is done or inactive. */
    157     uint16_t                cPosAdjustFramesLeft;
    158     uint8_t                 Padding3[2];
     160    uint16_t                cfPosAdjustLeft;
    159161    /** (Virtual) clock ticks per byte. */
    160162    uint64_t                cTicksPerByte;
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