Changeset 58600 in vbox for trunk/src/VBox/Devices/Audio
- Timestamp:
- Nov 6, 2015 12:26:32 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 103968
- Location:
- trunk/src/VBox/Devices/Audio
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Audio/AudioMixer.cpp
r58573 r58600 107 107 pSink->pszName, pMixStream, pSink->cStreams)); 108 108 109 /* Increase the stream's reference count to let others know 110 * we're reyling on it to be around now. */ 111 pStream->State.cRefs++; 112 109 113 if (ppStream) 110 114 *ppStream = pMixStream; … … 145 149 pSink->pszName, pMixStream, pSink->cStreams)); 146 150 151 /* Increase the stream's reference count to let others know 152 * we're reyling on it to be around now. */ 153 pStream->State.cRefs++; 154 147 155 if (ppStream) 148 156 *ppStream = pMixStream; … … 201 209 void AudioMixerDestroy(PAUDIOMIXER pMixer) 202 210 { 203 if (pMixer) 204 { 205 LogFlowFunc(("Destroying %s ...\n", pMixer->pszName)); 206 207 PAUDMIXSINK pSink = RTListGetFirst(&pMixer->lstSinks, AUDMIXSINK, Node); 208 while (pSink) 209 { 210 PAUDMIXSINK pNext = RTListNodeGetNext(&pSink->Node, AUDMIXSINK, Node); 211 bool fLast = RTListNodeIsLast(&pMixer->lstSinks, &pSink->Node); 212 213 AudioMixerRemoveSink(pMixer, pSink); 214 215 if (fLast) 216 break; 217 218 pSink = pNext; 219 } 220 221 Assert(pMixer->cSinks == 0); 222 211 if (!pMixer) 212 return; 213 214 LogFlowFunc(("Destroying %s ...\n", pMixer->pszName)); 215 216 PAUDMIXSINK pSink, pSinkNext; 217 RTListForEachSafe(&pMixer->lstSinks, pSink, pSinkNext, AUDMIXSINK, Node) 218 AudioMixerRemoveSink(pMixer, pSink); 219 220 Assert(pMixer->cSinks == 0); 221 222 if (pMixer->pszName) 223 { 223 224 RTStrFree(pMixer->pszName); 224 225 RTMemFree(pMixer); 226 } 225 pMixer->pszName = NULL; 226 } 227 228 RTMemFree(pMixer); 227 229 } 228 230 … … 233 235 return; 234 236 235 RTStrFree(pSink->pszName); 237 if (pSink->pszName) 238 RTStrFree(pSink->pszName); 236 239 237 240 RTMemFree(pSink); … … 383 386 #endif 384 387 388 /* Decrease the reference count again. */ 389 switch (pSink->enmDir) 390 { 391 case AUDMIXSINKDIR_INPUT: 392 { 393 Assert(pStream->pIn->State.cRefs); 394 pStream->pIn->State.cRefs--; 395 break; 396 } 397 398 case AUDMIXSINKDIR_OUTPUT: 399 { 400 Assert(pStream->pOut->State.cRefs); 401 pStream->pOut->State.cRefs--; 402 break; 403 } 404 405 default: 406 AssertMsgFailed(("Not implemented\n")); 407 break; 408 } 409 385 410 audioMixerDestroyStream(pStream); 386 411 } -
trunk/src/VBox/Devices/Audio/DevIchAc97.cpp
r58443 r58600 555 555 } 556 556 557 rc = pDrv->pConnector->pfn OpenIn(pDrv->pConnector,558 pszDesc, PDMAUDIORECSOURCE_LINE_IN, &streamCfg, &pDrv->LineIn.pStrmIn);559 LogFlowFunc(("LUN#%RU8: Opened line input with rc=%Rrc\n", uLUN, rc));557 rc = pDrv->pConnector->pfnCreateIn(pDrv->pConnector, 558 pszDesc, PDMAUDIORECSOURCE_LINE_IN, &streamCfg, &pDrv->LineIn.pStrmIn); 559 LogFlowFunc(("LUN#%RU8: Created line input with rc=%Rrc\n", uLUN, rc)); 560 560 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ 561 561 { … … 583 583 } 584 584 585 rc = pDrv->pConnector->pfn OpenOut(pDrv->pConnector, pszDesc, &streamCfg, &pDrv->Out.pStrmOut);586 LogFlowFunc(("LUN#%RU8: Opened output with rc=%Rrc\n", uLUN, rc));585 rc = pDrv->pConnector->pfnCreateOut(pDrv->pConnector, pszDesc, &streamCfg, &pDrv->Out.pStrmOut); 586 LogFlowFunc(("LUN#%RU8: Created output with rc=%Rrc\n", uLUN, rc)); 587 587 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ 588 588 { … … 610 610 } 611 611 612 rc = pDrv->pConnector->pfn OpenIn(pDrv->pConnector,613 pszDesc, PDMAUDIORECSOURCE_MIC, &streamCfg, &pDrv->MicIn.pStrmIn);614 LogFlowFunc(("LUN#%RU8: Opened mic input with rc=%Rrc\n", uLUN, rc));612 rc = pDrv->pConnector->pfnCreateIn(pDrv->pConnector, 613 pszDesc, PDMAUDIORECSOURCE_MIC, &streamCfg, &pDrv->MicIn.pStrmIn); 614 LogFlowFunc(("LUN#%RU8: Created mic input with rc=%Rrc\n", uLUN, rc)); 615 615 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ 616 616 { … … 642 642 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 643 643 { 644 pDrv->pConnector->pfn CloseIn(pDrv->pConnector, pDrv->LineIn.pStrmIn);644 pDrv->pConnector->pfnDestroyIn(pDrv->pConnector, pDrv->LineIn.pStrmIn); 645 645 AudioMixerRemoveStream(pThis->pSinkLineIn, pDrv->LineIn.phStrmIn); 646 646 … … 657 657 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 658 658 { 659 pDrv->pConnector->pfn CloseOut(pDrv->pConnector, pDrv->Out.pStrmOut);659 pDrv->pConnector->pfnDestroyOut(pDrv->pConnector, pDrv->Out.pStrmOut); 660 660 AudioMixerRemoveStream(pThis->pSinkOutput, pDrv->Out.phStrmOut); 661 661 … … 672 672 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 673 673 { 674 pDrv->pConnector->pfn CloseIn(pDrv->pConnector, pDrv->MicIn.pStrmIn);674 pDrv->pConnector->pfnDestroyIn(pDrv->pConnector, pDrv->MicIn.pStrmIn); 675 675 AudioMixerRemoveStream(pThis->pSinkMicIn, pDrv->MicIn.phStrmIn); 676 676 … … 844 844 } 845 845 846 static void ichac97MixerReset(PAC97STATE pThis) 847 { 846 static int ichac97MixerReset(PAC97STATE pThis) 847 { 848 AssertPtrReturn(pThis, VERR_INVALID_PARAMETER); 849 848 850 LogFlowFuncEnter(); 849 851 850 852 RT_ZERO(pThis->mixer_data); 853 854 /* 855 * Tear down mixer and streams. 856 */ 857 if (pThis->pMixer) 858 { 859 AudioMixerDestroy(pThis->pMixer); 860 pThis->pMixer = NULL; 861 } 862 863 pThis->pSinkLineIn = NULL; 864 pThis->pSinkMicIn = NULL; 865 pThis->pSinkOutput = NULL; 851 866 852 867 PAC97DRIVER pDrv; 853 868 RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node) 854 869 { 855 pDrv->Out.phStrmOut = NULL; 856 pDrv->pConnector->pfnCloseOut(pDrv->pConnector, pDrv->Out.pStrmOut); 857 pDrv->Out.pStrmOut = NULL; 858 pDrv->LineIn.phStrmIn = NULL; 859 pDrv->pConnector->pfnCloseIn(pDrv->pConnector, pDrv->LineIn.pStrmIn); 860 pDrv->LineIn.pStrmIn = NULL; 861 pDrv->MicIn.phStrmIn = NULL; 862 pDrv->pConnector->pfnCloseIn(pDrv->pConnector, pDrv->MicIn.pStrmIn); 863 pDrv->MicIn.pStrmIn = NULL; 864 } 865 866 pThis->pSinkOutput = NULL; 867 pThis->pSinkLineIn = NULL; 868 pThis->pSinkMicIn = NULL; 869 870 if (pThis->pMixer) 871 { 872 AudioMixerDestroy(pThis->pMixer); 873 pThis->pMixer = NULL; 874 } 875 876 int rc2 = AudioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThis->pMixer); 877 if (RT_SUCCESS(rc2)) 870 pDrv->pConnector->pfnDestroyIn (pDrv->pConnector, pDrv->LineIn.pStrmIn); 871 RT_ZERO(pDrv->LineIn); 872 873 pDrv->pConnector->pfnDestroyIn (pDrv->pConnector, pDrv->MicIn.pStrmIn); 874 RT_ZERO(pDrv->MicIn); 875 876 pDrv->pConnector->pfnDestroyOut(pDrv->pConnector, pDrv->Out.pStrmOut); 877 RT_ZERO(pDrv->Out); 878 } 879 880 /* 881 * (Re-)Create the mixer. The streams will be created on demand later. 882 */ 883 int rc = AudioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThis->pMixer); 884 if (RT_FAILURE(rc)) 885 return rc; 886 887 do 878 888 { 879 889 /* Set a default audio format for our mixer. */ … … 884 894 streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS; 885 895 886 rc2 = AudioMixerSetDeviceFormat(pThis->pMixer, &streamCfg); 887 AssertRC(rc2); 896 rc = AudioMixerSetDeviceFormat(pThis->pMixer, &streamCfg); 897 if (RT_FAILURE(rc)) 898 break; 888 899 889 900 /* Add all required audio sinks. */ 890 rc2 = AudioMixerAddSink(pThis->pMixer, "[Playback] PCM Output", 891 AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput); 892 AssertRC(rc2); 893 894 rc2 = AudioMixerAddSink(pThis->pMixer, "[Recording] Line In", 895 AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn); 896 AssertRC(rc2); 897 898 rc2 = AudioMixerAddSink(pThis->pMixer, "[Recording] Microphone In", 899 AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn); 900 AssertRC(rc2); 901 } 901 rc = AudioMixerAddSink(pThis->pMixer, "[Playback] PCM Output", AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput); 902 if (RT_FAILURE(rc)) 903 break; 904 905 rc = AudioMixerAddSink(pThis->pMixer, "[Recording] Line In", AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn); 906 if (RT_FAILURE(rc)) 907 break; 908 909 rc = AudioMixerAddSink(pThis->pMixer, "[Recording] Microphone In", AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn); 910 if (RT_FAILURE(rc)) 911 break; 912 913 } while (0); 914 915 /* Note: Make sure to reset all registers first before bailing out on error. */ 902 916 903 917 ichac97MixerStore(pThis, AC97_Reset , 0x0000); /* 6940 */ … … 951 965 uint8_t active[LAST_INDEX] = { 0 }; 952 966 ichac97ResetStreams(pThis, active); 967 968 return rc; 953 969 } 954 970 … … 1946 1962 if (pThis->uCodecModel == Codec_AD1980) 1947 1963 if (ichac97MixerLoad(pThis, AC97_AD_Misc) & AD_MISC_HPSEL) 1948 ichac97SetVolume(pThis, AC97_Headphone_Volume_Mute, PDMAUDIOMIXERCTL_VOLUME, 1964 ichac97SetVolume(pThis, AC97_Headphone_Volume_Mute, PDMAUDIOMIXERCTL_VOLUME, 1949 1965 ichac97MixerLoad(pThis, AC97_Headphone_Volume_Mute)); 1950 1966 … … 2262 2278 AssertPtr(pCon); 2263 2279 if ( !pCon->pfnIsInputOK (pCon, pDrv->LineIn.pStrmIn) 2264 && !pCon->pfnIsOutputOK(pCon, pDrv->Out.pStrmOut) 2265 && !pCon->pfnIsInputOK (pCon, pDrv->MicIn.pStrmIn)) 2266 { 2267 LogRel(("AC97: Falling back to NULL driver\n")); 2280 && !pCon->pfnIsInputOK (pCon, pDrv->MicIn.pStrmIn) 2281 && !pCon->pfnIsOutputOK(pCon, pDrv->Out.pStrmOut)) 2282 { 2283 LogRel(("AC97: Falling back to NULL driver (no sound audible)\n")); 2284 2285 ac97Reset(pDevIns); 2268 2286 2269 2287 /* Was not able initialize *any* stream. 2270 2288 * Select the NULL audio driver instead. */ 2271 pCon->pfnCloseIn (pCon, pDrv->LineIn.pStrmIn);2272 pCon->pfnCloseOut(pCon, pDrv->Out.pStrmOut);2273 pCon->pfnCloseIn (pCon, pDrv->MicIn.pStrmIn);2274 2275 pDrv->Out.pStrmOut = NULL;2276 pDrv->LineIn.pStrmIn = NULL;2277 pDrv->MicIn.pStrmIn = NULL;2278 2279 2289 pCon->pfnInitNull(pCon); 2280 ac97Reset(pDevIns);2281 2290 2282 2291 PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding", … … 2285 2294 } 2286 2295 else if ( !pCon->pfnIsInputOK (pCon, pDrv->LineIn.pStrmIn) 2287 || !pCon->pfnIs OutputOK(pCon, pDrv->Out.pStrmOut)2288 || !pCon->pfnIs InputOK (pCon, pDrv->MicIn.pStrmIn))2296 || !pCon->pfnIsInputOK (pCon, pDrv->MicIn.pStrmIn) 2297 || !pCon->pfnIsOutputOK(pCon, pDrv->Out.pStrmOut)) 2289 2298 { 2290 2299 char szMissingStreams[255]; -
trunk/src/VBox/Devices/Audio/DevIchHda.cpp
r58170 r58600 2303 2303 } 2304 2304 2305 static DECLCALLBACK(void) hda CloseIn(PHDASTATE pThis, PDMAUDIORECSOURCE enmRecSource)2305 static DECLCALLBACK(void) hdaDestroyIn(PHDASTATE pThis, PDMAUDIORECSOURCE enmRecSource) 2306 2306 { 2307 2307 NOREF(pThis); … … 2310 2310 } 2311 2311 2312 static DECLCALLBACK(void) hda CloseOut(PHDASTATE pThis)2312 static DECLCALLBACK(void) hdaDestroyOut(PHDASTATE pThis) 2313 2313 { 2314 2314 NOREF(pThis); … … 2316 2316 } 2317 2317 2318 static DECLCALLBACK(int) hda OpenIn(PHDASTATE pThis,2319 const char *pszName, PDMAUDIORECSOURCE enmRecSource,2320 PPDMAUDIOSTREAMCFG pCfg)2318 static DECLCALLBACK(int) hdaCreateIn(PHDASTATE pThis, 2319 const char *pszName, PDMAUDIORECSOURCE enmRecSource, 2320 PPDMAUDIOSTREAMCFG pCfg) 2321 2321 { 2322 2322 PAUDMIXSINK pSink; … … 2349 2349 } 2350 2350 2351 rc = pDrv->pConnector->pfn OpenIn(pDrv->pConnector, pszDesc, enmRecSource, pCfg, &pDrv->LineIn.pStrmIn);2352 LogFlowFunc(("LUN#%RU8: Opened input \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc));2351 rc = pDrv->pConnector->pfnCreateIn(pDrv->pConnector, pszDesc, enmRecSource, pCfg, &pDrv->LineIn.pStrmIn); 2352 LogFlowFunc(("LUN#%RU8: Created input \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc)); 2353 2353 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ 2354 2354 { … … 2366 2366 } 2367 2367 2368 static DECLCALLBACK(int) hda OpenOut(PHDASTATE pThis,2369 const char *pszName, PPDMAUDIOSTREAMCFG pCfg)2368 static DECLCALLBACK(int) hdaCreateOut(PHDASTATE pThis, 2369 const char *pszName, PPDMAUDIOSTREAMCFG pCfg) 2370 2370 { 2371 2371 int rc = VINF_SUCCESS; … … 2381 2381 } 2382 2382 2383 rc = pDrv->pConnector->pfn OpenOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut);2384 LogFlowFunc(("LUN#%RU8: Opened output \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc));2383 rc = pDrv->pConnector->pfnCreateOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut); 2384 LogFlowFunc(("LUN#%RU8: Created output \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc)); 2385 2385 if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ 2386 2386 { … … 3761 3761 3762 3762 /* Audio driver callbacks for multiplexing. */ 3763 pThis->pCodec->pfn CloseIn = hdaCloseIn;3764 pThis->pCodec->pfn CloseOut = hdaCloseOut;3765 pThis->pCodec->pfn OpenIn = hdaOpenIn;3766 pThis->pCodec->pfn OpenOut = hdaOpenOut;3767 pThis->pCodec->pfnReset = hdaCodecReset;3768 pThis->pCodec->pfnSetVolume = hdaSetVolume;3763 pThis->pCodec->pfnDestroyIn = hdaDestroyIn; 3764 pThis->pCodec->pfnDestroyOut = hdaDestroyOut; 3765 pThis->pCodec->pfnCreateIn = hdaCreateIn; 3766 pThis->pCodec->pfnCreateOut = hdaCreateOut; 3767 pThis->pCodec->pfnReset = hdaCodecReset; 3768 pThis->pCodec->pfnSetVolume = hdaSetVolume; 3769 3769 3770 3770 pThis->pCodec->pHDAState = pThis; /* Assign HDA controller state to codec. */ -
trunk/src/VBox/Devices/Audio/DevIchHdaCodec.cpp
r57393 r58600 2611 2611 { 2612 2612 case PI_INDEX: 2613 rc = pThis->pfn OpenIn(pThis->pHDAState, "hda.in", PDMAUDIORECSOURCE_LINE_IN, pCfg);2613 rc = pThis->pfnCreateIn(pThis->pHDAState, "hda.in", PDMAUDIORECSOURCE_LINE_IN, pCfg); 2614 2614 break; 2615 2615 2616 2616 case PO_INDEX: 2617 rc = pThis->pfn OpenOut(pThis->pHDAState, "hda.out", pCfg);2617 rc = pThis->pfnCreateOut(pThis->pHDAState, "hda.out", pCfg); 2618 2618 break; 2619 2619 2620 2620 #ifdef VBOX_WITH_HDA_MIC_IN 2621 2621 case MC_INDEX: 2622 rc = pThis->pfn OpenIn(pThis->pHDAState, "hda.mc", PDMAUDIORECSOURCE_MIC, pCfg);2622 rc = pThis->pfnCreateIn(pThis->pHDAState, "hda.mc", PDMAUDIORECSOURCE_MIC, pCfg); 2623 2623 break; 2624 2624 #endif -
trunk/src/VBox/Devices/Audio/DevIchHdaCodec.h
r58132 r58600 111 111 #endif 112 112 /** Callbacks to the HDA controller, mostly used for multiplexing to the various host backends. */ 113 DECLR3CALLBACKMEMBER(void, pfn CloseIn, (PHDASTATE pThis, PDMAUDIORECSOURCE enmRecSource));114 DECLR3CALLBACKMEMBER(void, pfn CloseOut, (PHDASTATE pThis));115 DECLR3CALLBACKMEMBER(int, pfn OpenIn, (PHDASTATE pThis, const char *pszName, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg));116 DECLR3CALLBACKMEMBER(int, pfn OpenOut, (PHDASTATE pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg));113 DECLR3CALLBACKMEMBER(void, pfnDestroyIn, (PHDASTATE pThis, PDMAUDIORECSOURCE enmRecSource)); 114 DECLR3CALLBACKMEMBER(void, pfnDestroyOut, (PHDASTATE pThis)); 115 DECLR3CALLBACKMEMBER(int, pfnCreateIn, (PHDASTATE pThis, const char *pszName, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg)); 116 DECLR3CALLBACKMEMBER(int, pfnCreateOut, (PHDASTATE pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg)); 117 117 DECLR3CALLBACKMEMBER(int, pfnSetVolume, (PHDASTATE pThis, ENMSOUNDSOURCE enmSource, bool fMute, uint8_t uVolLeft, uint8_t uVolRight)); 118 118 /** Callbacks by codec implementation. */ -
trunk/src/VBox/Devices/Audio/DevSB16.cpp
r56838 r58600 1946 1946 } 1947 1947 1948 int rc2 = pDrv->pConnector->pfn OpenOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut);1949 LogFlowFunc(("LUN#%RU8: Opened output with rc=%Rrc\n", uLUN, rc));1948 int rc2 = pDrv->pConnector->pfnCreateOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut); 1949 LogFlowFunc(("LUN#%RU8: Created output with rc=%Rrc\n", uLUN, rc)); 1950 1950 if (rc2 == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */ 1951 1951 { … … 2193 2193 LogRel(("SB16: Warning: Unable to enable/use output for LUN#%RU8\n", uLUN)); 2194 2194 2195 pCon->pfn CloseOut(pCon, pDrv->Out.pStrmOut);2195 pCon->pfnDestroyOut(pCon, pDrv->Out.pStrmOut); 2196 2196 pDrv->Out.pStrmOut = NULL; 2197 2197 -
trunk/src/VBox/Devices/Audio/DrvAudio.cpp
r58378 r58600 574 574 AssertPtrReturn(pThis, VERR_INVALID_POINTER); 575 575 576 if (pGstStrmOut) 577 { 578 drvAudioGstOutFreeRes(pGstStrmOut); 579 580 if (pGstStrmOut->pHstStrmOut) 581 { 582 /* Unregister from parent first. */ 583 RTListNodeRemove(&pGstStrmOut->Node); 584 585 /* Try destroying the associated host output stream. This could 586 * be skipped if there are other guest output streams with this 587 * host stream. */ 588 drvAudioDestroyHstOut(pThis, pGstStrmOut->pHstStrmOut); 589 } 590 591 RTMemFree(pGstStrmOut); 592 } 576 if (!pGstStrmOut) 577 return VINF_SUCCESS; 578 579 if (pGstStrmOut->State.cRefs > 1) /* Do other objects still have a reference to it? Bail out. */ 580 return VERR_WRONG_ORDER; 581 582 drvAudioGstOutFreeRes(pGstStrmOut); 583 584 if (pGstStrmOut->pHstStrmOut) 585 { 586 /* Unregister from parent first. */ 587 RTListNodeRemove(&pGstStrmOut->Node); 588 589 /* Try destroying the associated host output stream. This could 590 * be skipped if there are other guest output streams with this 591 * host stream. */ 592 drvAudioDestroyHstOut(pThis, pGstStrmOut->pHstStrmOut); 593 } 594 595 RTMemFree(pGstStrmOut); 593 596 594 597 return VINF_SUCCESS; … … 666 669 if (RT_SUCCESS(rc)) 667 670 { 671 pGstStrmOut->State.cRefs = 1; 668 672 pGstStrmOut->State.fActive = false; 669 673 pGstStrmOut->State.fEmpty = true; … … 921 925 drvAudioStreamCfgPrint(pCfg); 922 926 #endif 927 pGstStrmIn->State.cRefs = 1; 923 928 pGstStrmIn->State.fActive = false; 924 929 pGstStrmIn->State.fEmpty = true; … … 1158 1163 LogFlowFunc(("%s\n", pGstStrmIn->MixBuf.pszName)); 1159 1164 1160 if (pGstStrmIn) 1161 { 1162 drvAudioGstInFreeRes(pGstStrmIn); 1163 1164 if (pGstStrmIn->pHstStrmIn) 1165 { 1166 /* Unlink child. */ 1167 pGstStrmIn->pHstStrmIn->pGstStrmIn = NULL; 1168 1169 /* Try destroying the associated host input stream. This could 1170 * be skipped if there are other guest input streams with this 1171 * host stream. */ 1172 drvAudioDestroyHstIn(pThis, pGstStrmIn->pHstStrmIn); 1173 } 1174 1175 RTMemFree(pGstStrmIn); 1176 } 1165 if (!pGstStrmIn) 1166 return VINF_SUCCESS; 1167 1168 if (pGstStrmIn->State.cRefs > 1) /* Do other objects still have a reference to it? Bail out. */ 1169 return VERR_WRONG_ORDER; 1170 1171 drvAudioGstInFreeRes(pGstStrmIn); 1172 1173 if (pGstStrmIn->pHstStrmIn) 1174 { 1175 /* Unlink child. */ 1176 pGstStrmIn->pHstStrmIn->pGstStrmIn = NULL; 1177 1178 /* Try destroying the associated host input stream. This could 1179 * be skipped if there are other guest input streams with this 1180 * host stream. */ 1181 drvAudioDestroyHstIn(pThis, pGstStrmIn->pHstStrmIn); 1182 } 1183 1184 RTMemFree(pGstStrmIn); 1177 1185 1178 1186 return VINF_SUCCESS; … … 1720 1728 } 1721 1729 1722 static DECLCALLBACK(int) drvAudio OpenIn(PPDMIAUDIOCONNECTOR pInterface, const char *pszName,1723 PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg,1724 PPDMAUDIOGSTSTRMIN *ppGstStrmIn)1730 static DECLCALLBACK(int) drvAudioCreateIn(PPDMIAUDIOCONNECTOR pInterface, const char *pszName, 1731 PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg, 1732 PPDMAUDIOGSTSTRMIN *ppGstStrmIn) 1725 1733 { 1726 1734 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 1786 1794 } 1787 1795 1788 static DECLCALLBACK(int) drvAudio OpenOut(PPDMIAUDIOCONNECTOR pInterface, const char *pszName,1789 PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut)1796 static DECLCALLBACK(int) drvAudioCreateOut(PPDMIAUDIOCONNECTOR pInterface, const char *pszName, 1797 PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut) 1790 1798 { 1791 1799 AssertPtrReturn(pInterface, VERR_INVALID_POINTER); … … 1891 1899 } 1892 1900 1893 static DECLCALLBACK(void) drvAudio CloseIn(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn)1901 static DECLCALLBACK(void) drvAudioDestroyIn(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn) 1894 1902 { 1895 1903 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); … … 1898 1906 } 1899 1907 1900 static DECLCALLBACK(void) drvAudio CloseOut(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut)1908 static DECLCALLBACK(void) drvAudioDestroyOut(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut) 1901 1909 { 1902 1910 PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface); … … 1982 1990 pThis->IAudioConnector.pfnRead = drvAudioRead; 1983 1991 pThis->IAudioConnector.pfnWrite = drvAudioWrite; 1992 pThis->IAudioConnector.pfnIsActiveIn = drvAudioIsActiveIn; 1993 pThis->IAudioConnector.pfnIsActiveOut = drvAudioIsActiveOut; 1984 1994 pThis->IAudioConnector.pfnIsInputOK = drvAudioIsInputOK; 1985 1995 pThis->IAudioConnector.pfnIsOutputOK = drvAudioIsOutputOK; … … 1987 1997 pThis->IAudioConnector.pfnEnableOut = drvAudioEnableOut; 1988 1998 pThis->IAudioConnector.pfnEnableIn = drvAudioEnableIn; 1989 pThis->IAudioConnector.pfn CloseIn = drvAudioCloseIn;1990 pThis->IAudioConnector.pfn CloseOut = drvAudioCloseOut;1991 pThis->IAudioConnector.pfn OpenIn = drvAudioOpenIn;1992 pThis->IAudioConnector.pfn OpenOut = drvAudioOpenOut;1999 pThis->IAudioConnector.pfnDestroyIn = drvAudioDestroyIn; 2000 pThis->IAudioConnector.pfnDestroyOut = drvAudioDestroyOut; 2001 pThis->IAudioConnector.pfnCreateIn = drvAudioCreateIn; 2002 pThis->IAudioConnector.pfnCreateOut = drvAudioCreateOut; 1993 2003 pThis->IAudioConnector.pfnPlayOut = drvAudioPlayOut; 1994 pThis->IAudioConnector.pfnIsActiveIn = drvAudioIsActiveIn;1995 pThis->IAudioConnector.pfnIsActiveOut = drvAudioIsActiveOut;1996 2004 1997 2005 /*
Note:
See TracChangeset
for help on using the changeset viewer.