Changeset 88362 in vbox for trunk/src/VBox/Devices/Audio/DrvAudio.cpp
- Timestamp:
- Apr 5, 2021 12:31:17 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r88359 r88362 1892 1892 } 1893 1893 1894 #ifdef VBOX_WITH_AUDIO_CALLBACKS /** @todo r=bird: All this is non-sense that shall be replaced by a PDMIHOSTAUDIO partner interface. */1895 1896 /**1897 * @callback_method_impl{FNPDMHOSTAUDIOCALLBACK, Backend callback implementation.}1898 *1899 * @par Important:1900 * No calls back to the backend within this function, as the backend1901 * might hold any locks / critical sections while executing this1902 * callback. Will result in some ugly deadlocks (or at least locking1903 * order violations) then.1904 *1905 * @todo r=bird: The above warning is extremely bogus. You enter the critical1906 * section of the driver here, if anything, that will be the lock order1907 * violation.1908 */1909 static DECLCALLBACK(int) drvAudioBackendCallback(PPDMDRVINS pDrvIns, PDMAUDIOBACKENDCBTYPE enmType, void *pvUser, size_t cbUser)1910 {1911 AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);1912 RT_NOREF(pvUser, cbUser);1913 /* pvUser and cbUser are optional. */1914 1915 /** @todo r=bird: WTF *is* this? Seriously?!?1916 *1917 * DrvAudio will provide the host driver with a "callback" interface1918 * with methods like pfnNotifyDevicesChanged and pfnNotifyStatusChanged.1919 * The host drivers that implements callbacks can query the callback1920 * interface and make use of it.1921 */1922 1923 /* Get the upper driver (PDMIAUDIOCONNECTOR). */1924 AssertPtr(pDrvIns->pUpBase);1925 PPDMIAUDIOCONNECTOR pInterface = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIAUDIOCONNECTOR);1926 AssertPtr(pInterface);1927 PDRVAUDIO pThis = RT_FROM_MEMBER(pInterface, DRVAUDIO, IAudioConnector);1928 AssertPtr(pThis);1929 1930 int rc = RTCritSectEnter(&pThis->CritSect);1931 AssertRCReturn(rc, rc);1932 1933 LogFunc(("pThis=%p, enmType=%RU32, pvUser=%p, cbUser=%zu\n", pThis, enmType, pvUser, cbUser));1934 1935 switch (enmType)1936 {1937 case PDMAUDIOBACKENDCBTYPE_DEVICES_CHANGED:1938 LogRel(("Audio: Device configuration of driver '%s' has changed\n", pThis->szName));1939 drvAudioScheduleReInitInternal(pThis);1940 break;1941 1942 default:1943 AssertMsgFailed(("Not supported\n"));1944 break;1945 }1946 1947 RTCritSectLeave(&pThis->CritSect);1948 1949 LogFlowFunc(("Returning %Rrc\n", rc));1950 return rc;1951 }1952 1953 #endif /* VBOX_WITH_AUDIO_CALLBACKS */1954 1955 1894 #ifdef VBOX_WITH_AUDIO_ENUM 1956 1895 /** … … 2053 1992 AssertPtrNullReturn(pHostDrvAudio->pfnGetDevices, VERR_INVALID_POINTER); 2054 1993 AssertPtrNullReturn(pHostDrvAudio->pfnGetStatus, VERR_INVALID_POINTER); 2055 AssertPtrNullReturn(pHostDrvAudio->pfnSetCallback, VERR_INVALID_POINTER);2056 1994 AssertPtrReturn(pHostDrvAudio->pfnStreamCreate, VERR_INVALID_POINTER); 2057 1995 AssertPtrReturn(pHostDrvAudio->pfnStreamDestroy, VERR_INVALID_POINTER); … … 2107 2045 RT_NOREF(rc2); 2108 2046 /* Ignore rc. */ 2109 #endif2110 2111 #ifdef VBOX_WITH_AUDIO_CALLBACKS2112 /*2113 * If the backend supports it, offer a callback to this connector.2114 */2115 /** @todo r=bird: Total misdesign. If the backend wants to talk to us, it2116 * should use PDMIBASE_QUERY_INTERFACE to get an interface from us. */2117 if (pThis->pHostDrvAudio->pfnSetCallback)2118 {2119 rc2 = pThis->pHostDrvAudio->pfnSetCallback(pThis->pHostDrvAudio, drvAudioBackendCallback);2120 if (RT_FAILURE(rc2))2121 LogRel(("Audio: Error registering callback for host driver '%s', rc=%Rrc\n", pThis->szName, rc2));2122 /* Not fatal. */2123 }2124 2047 #endif 2125 2048 … … 3405 3328 3406 3329 3407 #ifdef VBOX_WITH_AUDIO_CALLBACKS3408 3330 /********************************************************************************************************************************* 3409 3331 * PDMIAUDIONOTIFYFROMHOST interface implementation. * 3410 3332 *********************************************************************************************************************************/ 3411 3333 #ifdef VBOX_WITH_AUDIO_CALLBACKS 3412 3334 /** 3413 3335 * @interface_method_impl{PDMIAUDIONOTIFYFROMHOST,pfnNotifyDevicesChanged}
Note:
See TracChangeset
for help on using the changeset viewer.