Changeset 88360 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 5, 2021 12:15:13 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/DrvHostAudioCoreAudio.cpp
r88358 r88360 108 108 PCOREAUDIODEVICEDATA pDefaultDevOut; 109 109 #ifdef VBOX_WITH_AUDIO_CALLBACKS 110 /** Callback function to the upper driver. 111 * Can be NULL if not being used / registered. */ 112 PFNPDMHOSTAUDIOCALLBACK pfnCallback; 110 /** Upwards notification interface. */ 111 PPDMIAUDIONOTIFYFROMHOST pIAudioNotifyFromHost; 113 112 #endif 114 113 } DRVHOSTCOREAUDIO, *PDRVHOSTCOREAUDIO; … … 1032 1031 } 1033 1032 1034 #ifdef VBOX_WITH_AUDIO_CALLBACKS 1035 PFNPDMHOSTAUDIOCALLBACK pfnCallback = pThis->pfnCallback; 1036 #endif 1037 1038 /* Make sure to leave the critical section before calling the callback. */ 1033 /* Make sure to leave the critical section before notify higher drivers/devices. */ 1039 1034 rc2 = RTCritSectLeave(&pThis->CritSect); 1040 1035 AssertRC(rc2); 1041 1036 1042 1037 #ifdef VBOX_WITH_AUDIO_CALLBACKS 1043 if (pfnCallback) 1044 pfnCallback(pThis->pDrvIns, PDMAUDIOBACKENDCBTYPE_DEVICES_CHANGED, NULL, 0); /* Ignore rc */ 1038 /* Notify the driver/device above us about possible changes in devices. */ 1039 if (pThis->pIAudioNotifyFromHost) 1040 pThis->pIAudioNotifyFromHost->pfnNotifyDevicesChanged(pThis->pIAudioNotifyFromHost); 1045 1041 #endif 1046 1042 … … 2204 2200 return rc; 2205 2201 } 2206 2207 2208 #ifdef VBOX_WITH_AUDIO_CALLBACKS2209 /**2210 * @interface_method_impl{PDMIHOSTAUDIO,pfnSetCallback}2211 */2212 static DECLCALLBACK(int) drvHostCoreAudioHA_SetCallback(PPDMIHOSTAUDIO pInterface, PFNPDMHOSTAUDIOCALLBACK pfnCallback)2213 {2214 AssertPtrReturn(pInterface, VERR_INVALID_POINTER);2215 /* pfnCallback will be handled below. */2216 2217 PDRVHOSTCOREAUDIO pThis = PDMIHOSTAUDIO_2_DRVHOSTCOREAUDIO(pInterface);2218 2219 int rc = RTCritSectEnter(&pThis->CritSect);2220 if (RT_SUCCESS(rc))2221 {2222 LogFunc(("pfnCallback=%p\n", pfnCallback));2223 2224 if (pfnCallback) /* Register. */2225 {2226 Assert(pThis->pfnCallback == NULL);2227 pThis->pfnCallback = pfnCallback;2228 }2229 else /* Unregister. */2230 {2231 if (pThis->pfnCallback)2232 pThis->pfnCallback = NULL;2233 }2234 2235 int rc2 = RTCritSectLeave(&pThis->CritSect);2236 AssertRC(rc2);2237 }2238 2239 return rc;2240 }2241 #endif2242 2202 2243 2203 … … 2603 2563 pThis->IHostAudio.pfnStreamPlay = drvHostCoreAudioHA_StreamPlay; 2604 2564 pThis->IHostAudio.pfnStreamCapture = drvHostCoreAudioHA_StreamCapture; 2605 #ifdef VBOX_WITH_AUDIO_CALLBACKS2606 pThis->IHostAudio.pfnSetCallback = drvHostCoreAudioHA_SetCallback;2607 pThis->pfnCallback = NULL;2608 #else2609 2565 pThis->IHostAudio.pfnSetCallback = NULL; 2610 #endif2611 2566 pThis->IHostAudio.pfnGetDevices = drvHostCoreAudioHA_GetDevices; 2612 2567 pThis->IHostAudio.pfnStreamGetPending = NULL; … … 2618 2573 int rc = RTCritSectInit(&pThis->CritSect); 2619 2574 AssertRCReturn(rc, rc); 2575 2576 #ifdef VBOX_WITH_AUDIO_CALLBACKS 2577 /* 2578 * Query the notification interface from the driver/device above us. 2579 */ 2580 pThis->pIAudioNotifyFromHost = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIAUDIONOTIFYFROMHOST); 2581 Assert(pThis->pIAudioNotifyFromHost); 2582 #endif 2620 2583 2621 2584 #ifdef VBOX_AUDIO_DEBUG_DUMP_PCM_DATA
Note:
See TracChangeset
for help on using the changeset viewer.