VirtualBox

Changeset 54491 in vbox


Ignore:
Timestamp:
Feb 25, 2015 1:23:21 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
98600
Message:

PDM/Audio: Fixed crashes on termination.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r54368 r54491  
    568568    pThis->IHostAudio.pfnInitOut    = _aDrvName##InitOut;    \
    569569    pThis->IHostAudio.pfnIsEnabled  = _aDrvName##IsEnabled;  \
    570     pThis->IHostAudio.pfnPlayOut    = _aDrvName##PlayOut;
     570    pThis->IHostAudio.pfnPlayOut    = _aDrvName##PlayOut;    \
     571    pThis->IHostAudio.pfnShutdown   = _aDrvName##Shutdown;
    571572
    572573/** Pointer to a host audio interface. */
     
    584585     */
    585586    DECLR3CALLBACKMEMBER(int, pfnInit, (PPDMIHOSTAUDIO pInterface));
     587
     588    /**
     589     * Shuts down the host-specific audio device.
     590     *
     591     * @returns VBox status code.
     592     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
     593     */
     594    DECLR3CALLBACKMEMBER(void, pfnShutdown, (PPDMIHOSTAUDIO pInterface));
     595
    586596    /**
    587597     * Initialize the host-specific audio device for input stream.
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r54428 r54491  
    12681268}
    12691269
    1270 static void drvAudioExit(PPDMDRVINS pDrvIns)
    1271 {
    1272     LogFlowFuncEnter();
    1273 
    1274     PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
    1275 
    1276     /* Tear down all host output streams. */
    1277     PPDMAUDIOHSTSTRMOUT pHstStrmOut = NULL;
    1278     while ((pHstStrmOut = drvAudioFindAnyHstOut(pThis, pHstStrmOut)))
    1279     {
    1280         pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, PDMAUDIOSTREAMCMD_DISABLE);
    1281         pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, pHstStrmOut);
    1282     }
    1283 
    1284     /* Tear down all host input streams. */
    1285     PPDMAUDIOHSTSTRMIN pHstStrmIn = NULL;
    1286     while ((pHstStrmIn = drvAudioFindNextHstIn(pThis, pHstStrmIn)))
    1287     {
    1288         pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, PDMAUDIOSTREAMCMD_DISABLE);
    1289         pThis->pHostDrvAudio->pfnFiniIn(pThis->pHostDrvAudio, pHstStrmIn);
    1290     }
    1291 }
    1292 
    12931270static struct audio_option audio_options[] =
    12941271{
     
    18171794    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
    18181795
    1819     drvAudioExit(pDrvIns);
     1796    PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
     1797
     1798    /* Tear down all host output streams. */
     1799    PPDMAUDIOHSTSTRMOUT pHstStrmOut = NULL;
     1800    while ((pHstStrmOut = drvAudioFindAnyHstOut(pThis, pHstStrmOut)))
     1801    {
     1802        pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, PDMAUDIOSTREAMCMD_DISABLE);
     1803        pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, pHstStrmOut);
     1804    }
     1805
     1806    /* Tear down all host input streams. */
     1807    PPDMAUDIOHSTSTRMIN pHstStrmIn = NULL;
     1808    while ((pHstStrmIn = drvAudioFindNextHstIn(pThis, pHstStrmIn)))
     1809    {
     1810        pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, PDMAUDIOSTREAMCMD_DISABLE);
     1811        pThis->pHostDrvAudio->pfnFiniIn(pThis->pHostDrvAudio, pHstStrmIn);
     1812    }
     1813
     1814    if (pThis->pHostDrvAudio->pfnShutdown)
     1815        pThis->pHostDrvAudio->pfnShutdown(pThis->pHostDrvAudio);
     1816
     1817    LogFlowFuncLeave();
    18201818}
    18211819
  • trunk/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp

    r54433 r54491  
    12731273}
    12741274
     1275static DECLCALLBACK(void) drvHostALSAAudioShutdown(PPDMIHOSTAUDIO pInterface)
     1276{
     1277    NOREF(pInterface);
     1278}
     1279
    12751280/**
    12761281 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     
    12841289
    12851290    return NULL;
    1286 }
    1287 
    1288 static DECLCALLBACK(void) drvHostAlsaAudioDestruct(PPDMDRVINS pDrvIns)
    1289 {
    12901291}
    12911292
     
    13381339    drvHostAlsaAudioConstruct,
    13391340    /* pfnDestruct */
    1340     drvHostAlsaAudioDestruct,
     1341    NULL,
    13411342    /* pfnRelocate */
    13421343    NULL,
  • trunk/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp

    r54433 r54491  
    19251925}
    19261926
     1927static DECLCALLBACK(void) drvHostCoreAudioShutdown(PPDMIHOSTAUDIO pInterface)
     1928{
     1929    NOREF(pInterface);
     1930}
     1931
    19271932static DECLCALLBACK(void *) drvHostCoreAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    19281933{
     
    19331938
    19341939    return NULL;
    1935 }
    1936 
    1937 static DECLCALLBACK(void) drvHostCoreAudioDestruct(PPDMDRVINS pDrvIns)
    1938 {
    19391940}
    19401941
     
    19861987    drvHostCoreAudioConstruct,
    19871988    /* pfnDestruct */
    1988     drvHostCoreAudioDestruct,
     1989    NULL,
    19891990    /* pfnRelocate */
    19901991    NULL,
  • trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp

    r54433 r54491  
    15091509}
    15101510
     1511static DECLCALLBACK(void) drvHostDSoundShutdown(PPDMIHOSTAUDIO pInterface)
     1512{
     1513    NOREF(pInterface);
     1514}
     1515
    15111516static DECLCALLBACK(int) drvHostDSoundInit(PPDMIHOSTAUDIO pInterface)
    15121517{
     
    15301535}
    15311536
    1532 
    1533 /*
    1534  * PDMIBASE
    1535  */
    1536 
    15371537static DECLCALLBACK(void *) drvHostDSoundQueryInterface(PPDMIBASE pInterface, const char *pszIID)
    15381538{
     
    15441544    return NULL;
    15451545}
    1546 
    1547 
    1548 /*
    1549  * PDM driver.
    1550  */
    15511546
    15521547static int dsoundConfigQueryStringAlloc(PCFGMNODE pNode, const char *pszName, char **ppszString)
  • trunk/src/VBox/Devices/Audio/DrvHostNullAudio.cpp

    r54433 r54491  
    207207}
    208208
    209 static DECLCALLBACK(void) drvHostNullAudioDestruct(PPDMDRVINS pDrvIns)
    210 {
    211     NOREF(pDrvIns);
     209static DECLCALLBACK(void) drvHostNullAudioShutdown(PPDMIHOSTAUDIO pInterface)
     210{
     211    NOREF(pInterface);
    212212}
    213213
     
    219219static DECLCALLBACK(int) drvHostNullAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
    220220{
     221    AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
     222    /* pCfg is optional. */
     223
    221224    PDRVHOSTNULLAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTNULLAUDIO);
    222225    LogRel(("Audio: Initializing NULL driver\n"));
     
    260263    drvHostNullAudioConstruct,
    261264    /* pfnDestruct */
    262     drvHostNullAudioDestruct,
     265    NULL,
    263266    /* pfnRelocate */
    264267    NULL,
  • trunk/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp

    r54433 r54491  
    906906}
    907907
     908static DECLCALLBACK(void) drvHostOSSAudioShutdown(PPDMIHOSTAUDIO pInterface)
     909{
     910    NOREF(pInterface);
     911}
     912
    908913/**
    909914 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     
    917922
    918923    return NULL;
    919 }
    920 
    921 static DECLCALLBACK(void) drvHostOSSAudioDestruct(PPDMDRVINS pDrvIns)
    922 {
    923924}
    924925
     
    971972    drvHostOSSAudioConstruct,
    972973    /* pfnDestruct */
    973     drvHostOSSAudioDestruct,
     974    NULL,
    974975    /* pfnRelocate */
    975976    NULL,
  • trunk/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp

    r54433 r54491  
    10711071}
    10721072
     1073static DECLCALLBACK(void) drvHostPulseAudioShutdown(PPDMIHOSTAUDIO pInterface)
     1074{
     1075    NOREF(pInterface);
     1076
     1077    LogFlowFuncEnter();
     1078
     1079    if (g_pMainLoop)
     1080        pa_threaded_mainloop_stop(g_pMainLoop);
     1081
     1082    if (g_pContext)
     1083    {
     1084        pa_context_disconnect(g_pContext);
     1085        pa_context_unref(g_pContext);
     1086        g_pContext = NULL;
     1087    }
     1088
     1089    if (g_pMainLoop)
     1090    {
     1091        pa_threaded_mainloop_free(g_pMainLoop);
     1092        g_pMainLoop = NULL;
     1093    }
     1094
     1095    LogFlowFuncLeave();
     1096}
     1097
    10731098/**
    10741099 * @interface_method_impl{PDMIBASE,pfnQueryInterface}
     
    10871112}
    10881113
    1089 static DECLCALLBACK(void) drvHostPulseAudioDestruct(PPDMDRVINS pDrvIns)
    1090 {
    1091     NOREF(pDrvIns);
    1092 
    1093     LogFlowFuncEnter();
    1094 
    1095     if (g_pMainLoop)
    1096         pa_threaded_mainloop_stop(g_pMainLoop);
    1097 
    1098     if (g_pContext)
    1099     {
    1100         pa_context_disconnect(g_pContext);
    1101         pa_context_unref(g_pContext);
    1102         g_pContext = NULL;
    1103     }
    1104 
    1105     if (g_pMainLoop)
    1106     {
    1107         pa_threaded_mainloop_free(g_pMainLoop);
    1108         g_pMainLoop = NULL;
    1109     }
    1110 
    1111     LogFlowFuncLeave();
    1112 }
    1113 
    11141114/**
    1115  * Construct a DirectSound Audio driver instance.
     1115 * Constructs a PulseAudio Audio driver instance.
    11161116 *
    11171117 * @copydoc FNPDMDRVCONSTRUCT
     
    11321132
    11331133    return VINF_SUCCESS;
     1134}
     1135
     1136/**
     1137 * Destructs a PulseAudio Audio driver instance.
     1138 *
     1139 * @copydoc FNPDMDRVCONSTRUCT
     1140 */
     1141static DECLCALLBACK(void) drvHostPulseAudioDestruct(PPDMDRVINS pDrvIns)
     1142{
     1143    NOREF(pDrvIns);
     1144    LogFlowFuncEnter();
    11341145}
    11351146
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r54368 r54491  
    356356
    357357    return VINF_SUCCESS;
     358}
     359
     360static DECLCALLBACK(void) drvAudioVRDEShutdown(PPDMIHOSTAUDIO pInterface)
     361{
     362    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
     363    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
     364
     365    if (pDrv->pConsoleVRDPServer)
     366        pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL);
    358367}
    359368
  • trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp

    r54368 r54491  
    627627
    628628    return VINF_SUCCESS;
     629}
     630
     631static DECLCALLBACK(void) drvAudioVideoRecShutdown(PPDMIHOSTAUDIO pInterface)
     632{
     633    NOREF(pInterface);
    629634}
    630635
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