VirtualBox

Changeset 89739 in vbox


Ignore:
Timestamp:
Jun 16, 2021 11:05:22 AM (4 years ago)
Author:
vboxsync
Message:

DevIchAc97: Make sure to retry ichac97R3MixerAddDrvStreams after a while if it fails (current code would just not retry unless the config (Hz) changed). bugref:9890

File:
1 edited

Legend:

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

    r89737 r89739  
    382382     *  commits to proving actual audio input bytes. */
    383383    bool                    fInputPreBuffered;
     384    /** This is ZERO if stream setup succeeded, otherwise it's the RTTimeNanoTS() at
     385     *  which to retry setting it up.  The latter applies only to same
     386     *  parameters. */
     387    uint64_t                nsRetrySetup;
    384388    /** (Virtual) clock ticks per transfer. */
    385389    uint64_t                cTransferTicks;
     
    10631067
    10641068    PRTCIRCBUF pCircBuf = pStreamCC->State.pCircBuf;
    1065     AssertPtr(pCircBuf);
     1069    AssertReturnStmt(pCircBuf, ichac97R3StreamUnlock(pStreamCC), VINF_SUCCESS);
    10661070
    10671071    int rc = VINF_SUCCESS;
     
    18651869        if (RT_SUCCESS(rc))
    18661870        {
    1867 
    18681871            PAC97DRIVER pDrv;
    18691872            RTListForEach(&pThisCC->lstDrv, pDrv, AC97DRIVER, Node)
     
    22052208    int rc = VINF_SUCCESS;
    22062209    if (   fForce
    2207         || !PDMAudioStrmCfgMatchesProps(&Cfg, &pStreamCC->State.Cfg.Props))
     2210        || !PDMAudioStrmCfgMatchesProps(&Cfg, &pStreamCC->State.Cfg.Props)
     2211        || (pStreamCC->State.nsRetrySetup && RTTimeNanoTS() >= pStreamCC->State.nsRetrySetup))
    22082212    {
    22092213        LogRel2(("AC97: Setting up stream #%u: %s\n", pStreamCC->u8SD, PDMAudioStrmCfgToString(&Cfg, szTmp, sizeof(szTmp)) ));
    22102214
    22112215        ichac97R3MixerRemoveDrvStreams(pDevIns, pThisCC, pMixSink, Cfg.enmDir, Cfg.enmPath);
     2216
    22122217        rc = ichac97R3MixerAddDrvStreams(pDevIns, pThisCC, pMixSink, &Cfg);
    22132218        if (RT_SUCCESS(rc))
    22142219        {
    22152220            PDMAudioStrmCfgCopy(&pStreamCC->State.Cfg, &Cfg);
     2221            pStreamCC->State.nsRetrySetup = 0;
    22162222            LogFlowFunc(("[SD%RU8] success (uHz=%u)\n", pStreamCC->u8SD, rc, PDMAudioPropsHz(&Cfg.Props)));
    22172223        }
     
    22202226            LogFunc(("[SD%RU8] ichac97R3MixerAddDrvStreams failed: %Rrc (uHz=%u)\n",
    22212227                     pStreamCC->u8SD, rc, PDMAudioPropsHz(&Cfg.Props)));
    2222             /** @todo r=bird: we should remember this somehow and prevent things from
    2223              *        working and ensure that we redo setup the next time the guest
    2224              *        tries to play/record something with this stream... */
     2228            pStreamCC->State.nsRetrySetup = RTTimeNanoTS() + 5*RT_NS_1SEC; /* retry in 5 seconds, unless config changes. */
    22252229        }
    22262230    }
     
    23012305        pStreamCC->State.fInputPreBuffered = false;
    23022306
    2303         /* (Re-)Open the stream if necessary. */
     2307        /* Set up (update) the AC'97 stream as needed. */
    23042308        rc = ichac97R3StreamSetUp(pDevIns, pThis, pThisCC, pStream, pStreamCC, false /* fForce */);
    23052309        if (RT_SUCCESS(rc))
    23062310        {
    2307             /*
    2308              * Open debug files.
    2309              */
     2311            /* Open debug files. */
    23102312            if (RT_LIKELY(!pStreamCC->Dbg.Runtime.fEnabled))
    23112313            { /* likely */ }
     
    23202322            }
    23212323
    2322             /*
    2323              * Do the actual enabling.
    2324              */
     2324            /* Do the actual enabling (won't fail as long as pSink is valid). */
    23252325            rc = AudioMixerSinkStart(pSink);
    23262326        }
     
    26782678        PAC97BMREGS     pRegs     = &pStream->Regs;
    26792679
     2680        /** @todo r=bird: this locking is overkill, we don't need the timer lock
     2681         *        unless we're going to call ichac97R3TimerSet. */
    26802682        DEVAC97_LOCK_BOTH_RETURN(pDevIns, pThis, pStream, VINF_IOM_R3_IOPORT_WRITE);
    26812683        switch (cb)
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