VirtualBox

Changeset 65676 in vbox for trunk/src


Ignore:
Timestamp:
Feb 8, 2017 11:53:48 AM (8 years ago)
Author:
vboxsync
Message:

Audio/DrvHostDSound.cpp: Fixed crashes.

File:
1 edited

Legend:

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

    r65674 r65676  
    469469static HRESULT directSoundPlayInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    470470{
     471    AssertPtrReturn(pThis,     E_POINTER);
     472    AssertPtrReturn(pStreamDS, E_POINTER);
     473
    471474    if (pStreamDS->Out.pDS != NULL)
    472475    {
     
    509512static HRESULT directSoundPlayClose(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    510513{
    511     AssertPtrReturn(pThis, E_POINTER);
     514    AssertPtrReturn(pThis,     E_POINTER);
    512515    AssertPtrReturn(pStreamDS, E_POINTER);
    513516
     
    636639        RT_ZERO(bc);
    637640        bc.dwSize = sizeof(bc);
     641
    638642        hr = IDirectSoundBuffer8_GetCaps(pStreamDS->Out.pDSB, &bc);
    639643        if (FAILED(hr))
     
    770774static HRESULT directSoundPlayGetStatus(PDRVHOSTDSOUND pThis, LPDIRECTSOUNDBUFFER8 pDSB, DWORD *pdwStatus)
    771775{
    772     AssertPtr(pThis);
     776    AssertPtrReturn(pThis, E_POINTER);
    773777    AssertPtrReturn(pDSB,  E_POINTER);
     778
    774779    AssertPtrNull(pdwStatus);
    775780
     
    843848static HRESULT directSoundPlayStart(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    844849{
    845     AssertPtrReturn(pThis,         E_POINTER);
     850    AssertPtrReturn(pThis,     E_POINTER);
    846851    AssertPtrReturn(pStreamDS, E_POINTER);
    847852
     
    886891 */
    887892
    888 static LPCGUID dsoundCaptureSelectDevice(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    889 {
    890     AssertPtrReturn(pThis,     NULL);
    891     AssertPtrReturn(pStreamDS, NULL);
    892     AssertPtrReturn(pStreamDS->pCfg, NULL);
     893static LPCGUID dsoundCaptureSelectDevice(PDRVHOSTDSOUND pThis, PPDMAUDIOSTREAMCFG pCfg)
     894{
     895    AssertPtrReturn(pThis, NULL);
     896    AssertPtrReturn(pCfg,  NULL);
    893897
    894898    int rc = VINF_SUCCESS;
     
    899903        PDSOUNDDEV pDev = NULL;
    900904
    901         switch (pStreamDS->pCfg->DestSource.Source)
     905        switch (pCfg->DestSource.Source)
    902906        {
    903907            case PDMAUDIORECSOURCE_LINE:
     
    932936        {
    933937            DSLOG(("DSound: Guest source '%s' is using host recording device '%s'\n",
    934                    DrvAudioHlpRecSrcToStr(pStreamDS->pCfg->DestSource.Source), pDev->pszName));
     938                   DrvAudioHlpRecSrcToStr(pCfg->DestSource.Source), pDev->pszName));
    935939
    936940            pGUID = &pDev->Guid;
     
    948952    /* This always has to be in the release log. */
    949953    LogRel(("DSound: Guest source '%s' is using host recording device with GUID '%s'\n",
    950             DrvAudioHlpRecSrcToStr(pStreamDS->pCfg->DestSource.Source), pszGUID ? pszGUID: "{?}"));
     954            DrvAudioHlpRecSrcToStr(pCfg->DestSource.Source), pszGUID ? pszGUID: "{?}"));
    951955
    952956    if (pszGUID)
     
    971975
    972976
    973 static HRESULT directSoundCaptureInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS)
    974 {
     977static HRESULT directSoundCaptureInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAM pStreamDS, PPDMAUDIOSTREAMCFG pCfg)
     978{
     979    AssertPtrReturn(pThis,     E_POINTER);
     980    AssertPtrReturn(pStreamDS, E_POINTER);
     981    AssertPtrReturn(pCfg,      E_POINTER);
     982
    975983    if (pStreamDS->In.pDSC != NULL)
    976984    {
     
    987995    else
    988996    {
    989         LPCGUID pGUID = dsoundCaptureSelectDevice(pThis, pStreamDS);
     997        LPCGUID pGUID = dsoundCaptureSelectDevice(pThis, pCfg);
    990998        hr = IDirectSoundCapture_Initialize(pStreamDS->In.pDSC, pGUID);
    991999        if (FAILED(hr))
     
    10611069        return E_INVALIDARG;
    10621070
    1063     HRESULT hr = directSoundCaptureInterfaceCreate(pThis, pStreamDS);
     1071    HRESULT hr = directSoundCaptureInterfaceCreate(pThis, pStreamDS, pCfgReq);
    10641072    if (FAILED(hr))
    10651073        return hr;
     
    12801288
    12811289        RTMemFree(pDev);
     1290        pDev = NULL;
    12821291    }
    12831292}
     
    16191628        directSoundPlayUnlock(pThis, pDSB, pv1, pv2, cb1, cb2);
    16201629
    1621         pStreamDS->Out.offPlayWritePos = (pStreamDS->Out.offPlayWritePos + PDMAUDIOPCMPROPS_S2B(pProps, cbWrittenTotal))
    1622                                        % cbBuffer;
     1630        pStreamDS->Out.offPlayWritePos = (pStreamDS->Out.offPlayWritePos + cbWrittenTotal) % cbBuffer;
    16231631
    16241632        DSLOGF(("DSound: %RU32/%RU32, buffer write pos %ld, rc=%Rrc\n",
    1625                 PDMAUDIOPCMPROPS_S2B(pProps, cbWrittenTotal), cbLive, pStreamDS->Out.offPlayWritePos, rc));
     1633                cbWrittenTotal, cbLive, pStreamDS->Out.offPlayWritePos, rc));
    16261634
    16271635        if (pStreamDS->Out.fRestartPlayback)
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