VirtualBox

Changeset 88358 in vbox for trunk/src


Ignore:
Timestamp:
Apr 4, 2021 11:35:36 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143605
Message:

Audio: Kicked out the unused callback registration interface aimed at the device side. This should be done using interfaces when/if needed (DrvAudio queries callback interfaces from the device, the device implements the ones it needs). bugref:9890

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

Legend:

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

    r88357 r88358  
    294294         *  UINT32_MAX for unlimited streams. */
    295295        uint32_t            cStreamsFree;
    296 #ifdef VBOX_WITH_AUDIO_CALLBACKS
    297         RTLISTANCHOR        lstCB;
    298 #endif
    299296        /** The driver's input confguration (tweakable via CFGM). */
    300297        DRVAUDIOCFG         Cfg;
     
    308305         *  UINT32_MAX for unlimited streams. */
    309306        uint32_t            cStreamsFree;
    310 #ifdef VBOX_WITH_AUDIO_CALLBACKS
    311         RTLISTANCHOR        lstCB;
    312 #endif
    313307        /** The driver's output confguration (tweakable via CFGM). */
    314308        DRVAUDIOCFG         Cfg;
     
    19001894
    19011895#ifdef VBOX_WITH_AUDIO_CALLBACKS  /** @todo r=bird: All this is non-sense that shall be replaced by a PDMIHOSTAUDIO partner interface. */
    1902 
    1903 /**
    1904  * Duplicates an audio callback.
    1905  *
    1906  * @returns Pointer to duplicated callback, or NULL on failure.
    1907  * @param   pCB                 Callback to duplicate.
    1908  */
    1909 static PPDMAUDIOCBRECORD drvAudioCallbackDuplicate(PPDMAUDIOCBRECORD pCB)
    1910 {
    1911     AssertPtrReturn(pCB, NULL);
    1912 
    1913     PPDMAUDIOCBRECORD pCBCopy = (PPDMAUDIOCBRECORD)RTMemDup((void *)pCB, sizeof(PDMAUDIOCBRECORD));
    1914     if (!pCBCopy)
    1915         return NULL;
    1916 
    1917     if (pCB->pvCtx)
    1918     {
    1919         pCBCopy->pvCtx = RTMemDup(pCB->pvCtx, pCB->cbCtx);
    1920         if (!pCBCopy->pvCtx)
    1921         {
    1922             RTMemFree(pCBCopy);
    1923             return NULL;
    1924         }
    1925 
    1926         pCBCopy->cbCtx = pCB->cbCtx;
    1927     }
    1928 
    1929     return pCBCopy;
    1930 }
    1931 
    1932 /**
    1933  * Destroys a given callback.
    1934  *
    1935  * @param   pCB                 Callback to destroy.
    1936  */
    1937 static void drvAudioCallbackDestroy(PPDMAUDIOCBRECORD pCB)
    1938 {
    1939     if (!pCB)
    1940         return;
    1941 
    1942     RTListNodeRemove(&pCB->Node);
    1943     if (pCB->pvCtx)
    1944     {
    1945         Assert(pCB->cbCtx);
    1946         RTMemFree(pCB->pvCtx);
    1947     }
    1948     RTMemFree(pCB);
    1949 }
    1950 
    1951 /**
    1952  * @interface_method_impl{PDMIAUDIOCONNECTOR,pfnRegisterCallbacks}
    1953  */
    1954 static DECLCALLBACK(int) drvAudioRegisterCallbacks(PPDMIAUDIOCONNECTOR pInterface,
    1955                                                    PPDMAUDIOCBRECORD paCallbacks, size_t cCallbacks)
    1956 {
    1957     PDRVAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVAUDIO, IAudioConnector);
    1958     AssertPtr(pThis);
    1959     AssertPtrReturn(paCallbacks, VERR_INVALID_POINTER);
    1960     AssertReturn(cCallbacks,     VERR_INVALID_PARAMETER);
    1961     int rc = RTCritSectEnter(&pThis->CritSect);
    1962     AssertRCReturn(rc, rc);
    1963 
    1964     /*
    1965      *
    1966      */
    1967     for (size_t i = 0; i < cCallbacks; i++)
    1968     {
    1969         PPDMAUDIOCBRECORD pCB = drvAudioCallbackDuplicate(&paCallbacks[i]);
    1970         if (!pCB)
    1971         {
    1972             rc = VERR_NO_MEMORY;
    1973             break;
    1974         }
    1975 
    1976         switch (pCB->enmSource)
    1977         {
    1978             case PDMAUDIOCBSOURCE_DEVICE:
    1979             {
    1980                 switch (pCB->Device.enmType)
    1981                 {
    1982                     case PDMAUDIODEVICECBTYPE_DATA_INPUT:
    1983                         RTListAppend(&pThis->In.lstCB, &pCB->Node);
    1984                         break;
    1985 
    1986                     case PDMAUDIODEVICECBTYPE_DATA_OUTPUT:
    1987                         RTListAppend(&pThis->Out.lstCB, &pCB->Node);
    1988                         break;
    1989 
    1990                     default:
    1991                         AssertMsgFailed(("Not supported\n"));
    1992                         break;
    1993                 }
    1994 
    1995                 break;
    1996             }
    1997 
    1998             default:
    1999                AssertMsgFailed(("Not supported\n"));
    2000                break;
    2001         }
    2002     }
    2003 
    2004     /** @todo Undo allocations on error. */
    2005 
    2006     RTCritSectLeave(&pThis->CritSect);
    2007     return rc;
    2008 }
    20091896
    20101897/**
     
    37363623    Assert(RTListIsEmpty(&pThis->lstStreams));
    37373624
    3738 #ifdef VBOX_WITH_AUDIO_CALLBACKS
    3739     /*
    3740      * Destroy callbacks, if any.
    3741      */
    3742     PPDMAUDIOCBRECORD pCB, pCBNext;
    3743     RTListForEachSafe(&pThis->In.lstCB, pCB, pCBNext, PDMAUDIOCBRECORD, Node)
    3744         drvAudioCallbackDestroy(pCB);
    3745 
    3746     RTListForEachSafe(&pThis->Out.lstCB, pCB, pCBNext, PDMAUDIOCBRECORD, Node)
    3747         drvAudioCallbackDestroy(pCB);
    3748 #endif
    3749 
    37503625    if (RTCritSectIsInitialized(&pThis->CritSect))
    37513626    {
     
    37943669     */
    37953670    RTListInit(&pThis->lstStreams);
    3796 #ifdef VBOX_WITH_AUDIO_CALLBACKS
    3797     RTListInit(&pThis->In.lstCB);
    3798     RTListInit(&pThis->Out.lstCB);
    3799 #endif
    38003671
    38013672    /*
     
    39773848    pThis->IAudioConnector.pfnStreamPlay        = drvAudioStreamPlay;
    39783849    pThis->IAudioConnector.pfnStreamCapture     = drvAudioStreamCapture;
    3979 #ifdef VBOX_WITH_AUDIO_CALLBACKS
    3980     pThis->IAudioConnector.pfnRegisterCallbacks = drvAudioRegisterCallbacks;
    3981 #endif
    39823850
    39833851    /*
  • trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp

    r88270 r88358  
    299299#ifndef VBOX_WITH_AUDIO_CALLBACKS
    300300    /** The device has to be reinitialized.
    301      *  Note: Only needed if VBOX_WITH_AUDIO_CALLBACKS is not defined, as otherwise
    302      *        the Audio Connector will take care of this as soon as this backend
    303      *        tells it to do so via the provided audio callback. */
     301     * @note Only needed if VBOX_WITH_AUDIO_CALLBACKS is not defined, as otherwise
     302     *       the Audio Connector will take care of this as soon as this backend
     303     *       tells it to do so via the provided audio callback. */
    304304    COREAUDIOSTATUS_REINIT,
    305305#endif
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