VirtualBox

Changeset 88381 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 7, 2021 8:43:55 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
143628
Message:

Audio: Made the pfnInit method of the PDMIHOSTAUDIO interface optional. Removed a bunch of stubs and moved the DSound init code to the constructor. bugref:9890

Location:
trunk/src/VBox/Main/src-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/DrvAudioRec.cpp

    r88380 r88381  
    635635
    636636/**
    637  * @interface_method_impl{PDMIHOSTAUDIO,pfnInit}
    638  */
    639 static DECLCALLBACK(int) drvAudioVideoRecHA_Init(PPDMIHOSTAUDIO pInterface)
    640 {
    641     AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
    642 
    643     LogFlowFuncEnter();
    644 
    645     PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface);
    646 
    647     LogRel(("Recording: Audio driver is using %RU32Hz, %RU16bit, %RU8 channel%s\n",
    648             PDMAudioPropsHz(&pThis->CodecParms.PCMProps), PDMAudioPropsSampleBits(&pThis->CodecParms.PCMProps),
    649             PDMAudioPropsChannels(&pThis->CodecParms.PCMProps), PDMAudioPropsChannels(&pThis->CodecParms.PCMProps) == 1 ? "" : "s"));
    650 
    651     int rc = avRecSinkInit(pThis, &pThis->Sink, &pThis->ContainerParms, &pThis->CodecParms);
    652     if (RT_FAILURE(rc))
    653         LogRel(("Recording: Audio recording driver failed to initialize, rc=%Rrc\n", rc));
    654     else
    655         LogRel2(("Recording: Audio recording driver initialized\n"));
    656 
    657     return rc;
    658 }
    659 
    660 
    661 /**
    662637 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture}
    663638 */
     
    11281103    pDrvIns->IBase.pfnQueryInterface = drvAudioVideoRecQueryInterface;
    11291104    /* IHostAudio */
    1130     pThis->IHostAudio.pfnInit               = drvAudioVideoRecHA_Init;
     1105    pThis->IHostAudio.pfnInit               = NULL;
    11311106    pThis->IHostAudio.pfnShutdown           = drvAudioVideoRecHA_Shutdown;
    11321107    pThis->IHostAudio.pfnGetConfig          = drvAudioVideoRecHA_GetConfig;
     
    12141189     * Described in CFGM tree.
    12151190     */
     1191/** @todo r=bird: What on earth do you think you need this for?!? It's not an
     1192 * interface lower drivers are supposed to be messing with! */
    12161193    pThis->pDrvAudio = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIAUDIOCONNECTOR);
    12171194    AssertMsgReturn(pThis->pDrvAudio, ("Configuration error: No upper interface specified!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
     
    12221199#endif
    12231200
    1224     return VINF_SUCCESS;
     1201    /*
     1202     * Init the recording sink.
     1203     */
     1204    LogRel(("Recording: Audio driver is using %RU32Hz, %RU16bit, %RU8 channel%s\n",
     1205            PDMAudioPropsHz(&pThis->CodecParms.PCMProps), PDMAudioPropsSampleBits(&pThis->CodecParms.PCMProps),
     1206            PDMAudioPropsChannels(&pThis->CodecParms.PCMProps), PDMAudioPropsChannels(&pThis->CodecParms.PCMProps) == 1 ? "" : "s"));
     1207
     1208    rc = avRecSinkInit(pThis, &pThis->Sink, &pThis->ContainerParms, &pThis->CodecParms);
     1209    if (RT_SUCCESS(rc))
     1210        LogRel2(("Recording: Audio recording driver initialized\n"));
     1211    else
     1212        LogRel(("Recording: Audio recording driver initialization failed: %Rrc\n", rc));
     1213
     1214    return rc;
    12251215}
    12261216
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r88380 r88381  
    213213}
    214214
    215 
    216 /**
    217  * @interface_method_impl{PDMIHOSTAUDIO,pfnInit}
    218  */
    219 static DECLCALLBACK(int) drvAudioVrdeHA_Init(PPDMIHOSTAUDIO pInterface)
    220 {
    221     RT_NOREF(pInterface);
    222     LogFlowFuncEnter();
    223 
    224     return VINF_SUCCESS;
    225 }
    226 
    227 
    228215/**
    229216 * @interface_method_impl{PDMIHOSTAUDIO,pfnStreamCapture}
     
    703690    pDrvIns->IBase.pfnQueryInterface = drvAudioVrdeQueryInterface;
    704691    /* IHostAudio */
    705     pThis->IHostAudio.pfnInit              = drvAudioVrdeHA_Init;
     692    pThis->IHostAudio.pfnInit              = NULL;
    706693    pThis->IHostAudio.pfnShutdown          = drvAudioVrdeHA_Shutdown;
    707694    pThis->IHostAudio.pfnGetConfig         = drvAudioVrdeHA_GetConfig;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette