VirtualBox

Changeset 89128 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 17, 2021 11:31:36 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144469
Message:

DrvHostAudioWasApi: A few minor fixes. bugref:9890

File:
1 edited

Legend:

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

    r89089 r89128  
    294294    static RTSTRTUPLE const s_aEnable[2] =
    295295    {
    296         RT_STR_TUPLE("DISABLED"),
    297         RT_STR_TUPLE("ENABLED ")
     296        { RT_STR_TUPLE("DISABLED") },
     297        { RT_STR_TUPLE("ENABLED ") },
    298298    };
    299299    PCRTSTRTUPLE pTuple = &s_aEnable[pStreamWas->fEnabled];
     
    303303    static RTSTRTUPLE const s_aStarted[2] =
    304304    {
    305         RT_STR_TUPLE(" STOPPED"),
    306         RT_STR_TUPLE(" STARTED")
     305        { RT_STR_TUPLE(" STOPPED") },
     306        { RT_STR_TUPLE(" STARTED") },
    307307    };
    308308    pTuple = &s_aStarted[pStreamWas->fStarted];
     
    312312    static RTSTRTUPLE const s_aDraining[2] =
    313313    {
    314         RT_STR_TUPLE(""),
    315         RT_STR_TUPLE(" DRAINING")
     314        { RT_STR_TUPLE("")          },
     315        { RT_STR_TUPLE(" DRAINING") },
    316316    };
    317317    pTuple = &s_aDraining[pStreamWas->fDraining];
     
    319319    off += pTuple->cch;
    320320
     321    Assert(off < sizeof(pStreamCA->szStatus));
    321322    pStreamWas->szStatus[off] = '\0';
    322323    return pStreamWas->szStatus;
     
    21262127
    21272128    /*
    2128      * We will not stop a draining output stream, otherwise the actions are the same here.
     2129     * Always try stop it (draining or no).
    21292130     */
    21302131    pStreamWas->fEnabled         = false;
     
    22502251        if (!pStreamWas->fDraining)
    22512252        {
    2252             if (pStreamWas->fStarted)
     2253            uint64_t const msNow           = RTTimeMilliTS();
     2254            uint64_t       msDrainDeadline = 0;
     2255            UINT32         cFramesPending  = 0;
     2256            HRESULT hrc = pStreamWas->pDevCfg->pIAudioClient->GetCurrentPadding(&cFramesPending);
     2257            if (SUCCEEDED(hrc))
     2258                msDrainDeadline = msNow
     2259                                + PDMAudioPropsFramesToMilli(&pStreamWas->Cfg.Props,
     2260                                                             RT_MIN(cFramesPending,
     2261                                                                    pStreamWas->Cfg.Backend.cFramesBufferSize * 2))
     2262                                + 1 /*fudge*/;
     2263            else
    22532264            {
    2254                 uint64_t const msNow           = RTTimeMilliTS();
    2255                 uint64_t       msDrainDeadline = 0;
    2256                 UINT32         cFramesPending  = 0;
    2257                 HRESULT hrc = pStreamWas->pDevCfg->pIAudioClient->GetCurrentPadding(&cFramesPending);
    2258                 if (SUCCEEDED(hrc))
    2259                     msDrainDeadline = msNow
    2260                                     + PDMAudioPropsFramesToMilli(&pStreamWas->Cfg.Props,
    2261                                                                  RT_MIN(cFramesPending,
    2262                                                                         pStreamWas->Cfg.Backend.cFramesBufferSize * 2))
    2263                                     + 1 /*fudge*/;
    2264                 else
    2265                 {
    2266                     msDrainDeadline = msNow;
    2267                     LogRelMax(64, ("WasAPI: GetCurrentPadding fail on '%s' when starting draining: %Rhrc\n",
    2268                                    pStreamWas->Cfg.szName, hrc));
    2269                 }
    2270                 pStreamWas->msDrainDeadline = msDrainDeadline;
    2271                 pStreamWas->fDraining       = true;
     2265                msDrainDeadline = msNow;
     2266                LogRelMax(64, ("WasAPI: GetCurrentPadding fail on '%s' when starting draining: %Rhrc\n",
     2267                               pStreamWas->Cfg.szName, hrc));
    22722268            }
    2273             else
    2274                 LogFlowFunc(("Drain requested for '%s', but not started playback...\n", pStreamWas->Cfg.szName));
     2269            pStreamWas->msDrainDeadline = msDrainDeadline;
     2270            pStreamWas->fDraining       = true;
    22752271        }
    22762272        else
     
    22782274    }
    22792275    else
     2276    {
     2277        LogFlowFunc(("Drain requested for '%s', but not started playback...\n", pStreamWas->Cfg.szName));
    22802278        AssertStmt(!pStreamWas->fDraining, pStreamWas->fDraining = false);
     2279    }
    22812280    RTCritSectLeave(&pStreamWas->CritSect);
    22822281
     
    26262625        rc = VINF_SUCCESS;
    26272626    }
    2628     LogFlowFunc(("@%#RX64: cbWritten=%RU32 cMsDelta=%RU64 (%RU64 -> %RU64) {%s}\n", pStreamWas->offInternal, cbWritten,
     2627    LogFlowFunc(("@%#RX64: rc=%Rrc cbWritten=%RU32 cMsDelta=%RU64 (%RU64 -> %RU64) {%s}\n", pStreamWas->offInternal, rc, cbWritten,
    26292628                 msPrev ? msNow - msPrev : 0, msPrev, pStreamWas->msLastTransfer, drvHostWasStreamStatusString(pStreamWas) ));
    2630     return VINF_SUCCESS;
     2629    return rc;
    26312630}
    26322631
     
    27742773        rc = VINF_SUCCESS;
    27752774    }
    2776     LogFlowFunc(("@%#RX64: cbRead=%RU32 cMsDelta=%RU64 (%RU64 -> %RU64) {%s}\n", pStreamWas->offInternal, cbRead,
     2775    LogFlowFunc(("@%#RX64: rc=%Rrc cbRead=%RU32 cMsDelta=%RU64 (%RU64 -> %RU64) {%s}\n", pStreamWas->offInternal, rc, cbRead,
    27772776                 msPrev ? msNow - msPrev : 0, msPrev, pStreamWas->msLastTransfer, drvHostWasStreamStatusString(pStreamWas) ));
    27782777    return rc;
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