VirtualBox

Changeset 64581 in vbox for trunk


Ignore:
Timestamp:
Nov 4, 2016 3:51:21 PM (8 years ago)
Author:
vboxsync
Message:

Audio/HDA: Simplified hdaTimerMaybeStart() and hdaTimerMabeStop().

File:
1 edited

Legend:

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

    r64579 r64581  
    18371837    if (!fActive)
    18381838    {
    1839         if (pThis->cStreamsActive) /* Disable can be called mupltiple times. */
    1840             pThis->cStreamsActive--;
    1841 
    18421839# ifndef VBOX_WITH_AUDIO_HDA_CALLBACKS
    18431840        hdaTimerMaybeStop(pThis);
     
    18461843    else
    18471844    {
    1848         pThis->cStreamsActive++;
    18491845# ifndef VBOX_WITH_AUDIO_HDA_CALLBACKS
    18501846        hdaTimerMaybeStart(pThis);
     
    40704066static void hdaTimerMaybeStart(PHDASTATE pThis)
    40714067{
    4072     if (pThis->cStreamsActive == 0) /* Only start the timer if there at least is one active streams. */
    4073         return;
     4068    LogFlowFuncEnter();
    40744069
    40754070    if (!pThis->pTimer)
    40764071        return;
    40774072
     4073    pThis->cStreamsActive++;
     4074
     4075    /* Only start the timer at the first active stream. */
     4076    if (pThis->cStreamsActive == 1)
     4077    {
     4078        LogRel2(("HDA: Starting transfers\n"));
     4079
     4080        /* Set timer flag. */
     4081        ASMAtomicXchgBool(&pThis->fTimerActive, true);
     4082
     4083        /* Update current time timestamp. */
     4084        pThis->uTimerTS = TMTimerGet(pThis->pTimer);
     4085
     4086        /* Start transfers. */
     4087        hdaDoTransfers(pThis);
     4088    }
     4089}
     4090
     4091static void hdaTimerStop(PHDASTATE pThis)
     4092{
    40784093    LogFlowFuncEnter();
    40794094
    4080     LogRel2(("HDA: Starting transfers\n"));
     4095    LogRel2(("HDA: Stopping transfers\n"));
    40814096
    40824097    /* Set timer flag. */
    4083     ASMAtomicXchgBool(&pThis->fTimerActive, true);
    4084 
    4085     /* Update current time timestamp. */
    4086     pThis->uTimerTS = TMTimerGet(pThis->pTimer);
    4087 
    4088     /* Start transfers. */
    4089     hdaDoTransfers(pThis);
     4098    ASMAtomicXchgBool(&pThis->fTimerActive, false);
    40904099}
    40914100
    40924101static void hdaTimerMaybeStop(PHDASTATE pThis)
    40934102{
    4094     if (pThis->cStreamsActive) /* Some streams still active? Bail out. */
    4095         return;
     4103    LogFlowFuncEnter();
    40964104
    40974105    if (!pThis->pTimer)
    40984106        return;
    40994107
    4100     LogRel2(("HDA: Stopping transfers\n"));
    4101 
    4102     /* Set timer flag. */
    4103     ASMAtomicXchgBool(&pThis->fTimerActive, false);
     4108    if (pThis->cStreamsActive) /* Disable can be called mupltiple times. */
     4109        pThis->cStreamsActive--;
     4110
     4111    if (pThis->cStreamsActive == 0)
     4112        hdaTimerStop(pThis);
    41044113}
    41054114
     
    55245533     * Stop the timer, if any.
    55255534     */
    5526     hdaTimerMaybeStop(pThis);
     5535    hdaTimerStop(pThis);
     5536
     5537    pThis->cStreamsActive = 0;
    55275538# endif
    55285539
     
    56165627    /* Emulation of codec "wake up" (HDA spec 5.5.1 and 6.5). */
    56175628    HDA_REG(pThis, STATESTS) = 0x1;
    5618 
    5619 # ifndef VBOX_WITH_AUDIO_HDA_CALLBACKS
    5620     hdaTimerMaybeStart(pThis);
    5621 # endif
    56225629
    56235630    LogFlowFuncLeave();
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