VirtualBox

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


Ignore:
Timestamp:
Feb 17, 2015 1:13:02 PM (10 years ago)
Author:
vboxsync
Message:

PDM/Audio: Update.

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

Legend:

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

    r54108 r54230  
    14501450#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    14511451        if (mAudioVRDE)
    1452             mAudioVRDE->onVRDEInputIntercept(false /* fIntercept */);
     1452            mAudioVRDE->onVRDEControl(false /* fEnable */, 0 /* uFlags */);
    14531453#else
    14541454        mcAudioRefs--;
     
    15011501#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    15021502    if (mAudioVRDE)
    1503         mAudioVRDE->onVRDEInputIntercept(true /* fIntercept */);
     1503        mAudioVRDE->onVRDEControl(true /* fEnable */, 0 /* uFlags */);
    15041504#else
    15051505    ++mcAudioRefs;
     
    23802380                           (PFNRT)i_unplugCpu, 3,
    23812381                           this, pUVM, (VMCPUID)aCpu);
    2382    
     2382
    23832383        /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */
    23842384        alock.release();
     
    48214821     */
    48224822    bool fResume = false;
    4823     int rc = i_suspendBeforeConfigChange(pUVM, NULL, &fResume);
    4824     if (FAILED(rc))
    4825         return rc;
     4823    HRESULT hr = i_suspendBeforeConfigChange(pUVM, NULL, &fResume);
     4824    if (FAILED(hr))
     4825        return hr;
    48264826
    48274827    /*
     
    48304830     * here to make requests from under the lock in order to serialize them.
    48314831     */
    4832     PVMREQ pReq;
    4833     int vrc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/,
    4834                                (PFNRT)i_changeNetworkAttachment, 6,
    4835                                this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
     4832    int rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/,
     4833                              (PFNRT)i_changeNetworkAttachment, 6,
     4834                              this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
    48364835
    48374836    if (fResume)
    48384837        i_resumeAfterConfigChange(pUVM);
    48394838
    4840     if (RT_SUCCESS(vrc))
    4841     {
    4842         LogFlowThisFunc(("Returns S_OK\n"));
     4839    if (RT_SUCCESS(rc))
    48434840        return S_OK;
    4844     }
    48454841
    48464842    return setError(E_FAIL,
    4847                     tr("Could not change the network adaptor attachement type (%Rrc)"),
    4848                     vrc);
     4843                    tr("Could not change the network adaptor attachement type (%Rrc)"), rc);
    48494844}
    48504845
  • trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp

    r53442 r54230  
    11/* $Id$ */
    22/** @file
    3  * VBox Console VRDP Helper class
     3 * VBox Console VRDP helper class.
    44 */
    55
    66/*
    7  * Copyright (C) 2006-2014 Oracle Corporation
     7 * Copyright (C) 2006-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    651651            size_t cbPortRange = portRange.length() + 1;
    652652
    653             if (cbPortRange >= 0x10000)
    654             {
    655                 /* More than 64K seems to be an  invalid port range string. */
     653            if (cbPortRange >= _64K)
     654            {
     655                /* More than 64K seems to be an invalid port range string. */
    656656                rc = VERR_TOO_MUCH_DATA;
    657657                break;
     
    797797
    798798                HRESULT hrc = server->mConsole->i_machine()->GetExtraData(com::Bstr(extraData).raw(),
    799                                                                         bstrValue.asOutParam());
     799                                                                          bstrValue.asOutParam());
    800800                if (FAILED(hrc) || bstrValue.isEmpty())
    801801                {
     
    805805
    806806                    hrc = server->mConsole->i_machine()->GetExtraData(com::Bstr(extraData).raw(),
    807                                                                     bstrValue.asOutParam());
     807                                                                      bstrValue.asOutParam());
    808808                    if (FAILED(hrc))
    809809                    {
     
    817817                const char *pszPropertyName = &pFeature->achInfo[9];
    818818                HRESULT hrc = server->mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr(pszPropertyName).raw(),
    819                                                                                  bstrValue.asOutParam());
     819                                                                                   bstrValue.asOutParam());
    820820                if (FAILED(hrc))
    821821                {
     
    957957
    958958#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    959         pServer->mConsole->i_getAudioVRDE()->onVRDEInputIntercept(false);
     959        AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE();
     960        if (pVRDE)
     961            pVRDE->onVRDEInputIntercept(false /* fIntercept */);
    960962#else
    961963        PPDMIAUDIOSNIFFERPORT pPort = pServer->mConsole->i_getAudioSniffer()->getAudioSnifferPort();
     
    983985{
    984986    ConsoleVRDPServer *pServer = static_cast<ConsoleVRDPServer*>(pvCallback);
     987    AssertPtrReturn(pServer, VERR_INVALID_POINTER);
    985988
    986989    LogFlowFunc(("%x\n", fu32Intercept));
     
    10181021        case VRDE_CLIENT_INTERCEPT_AUDIO_INPUT:
    10191022        {
    1020             /* This request is processed internally by the ConsoleVRDPServer.
     1023            /*
     1024             * This request is processed internally by the ConsoleVRDPServer.
    10211025             * Only one client is allowed to intercept audio input.
    10221026             */
    10231027            if (ASMAtomicCmpXchgU32(&pServer->mu32AudioInputClientId, u32ClientId, 0) == true)
    10241028            {
    1025                 LogFunc(("Connected client %u\n", u32ClientId));
     1029                LogFunc(("Intercepting audio input by client %RU32\n", u32ClientId));
    10261030#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    1027                 pServer->mConsole->i_getAudioVRDE()->onVRDEInputIntercept(true);
     1031                AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE();
     1032                if (pVRDE)
     1033                    pVRDE->onVRDEInputIntercept(true /* fIntercept */);
    10281034#else
    10291035                PPDMIAUDIOSNIFFERPORT pPort = pServer->mConsole->i_getAudioSniffer()->getAudioSnifferPort();
     
    10441050            else
    10451051            {
    1046                 Log(("AUDIOIN: ignored client %u, active client %u\n", u32ClientId, pServer->mu32AudioInputClientId));
     1052                Log(("AUDIOIN: ignored client %RU32, active client %RU32\n", u32ClientId, pServer->mu32AudioInputClientId));
    10471053                rc = VERR_NOT_SUPPORTED;
    10481054            }
     
    13111317#endif
    13121318
     1319    AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE();
     1320    if (!pVRDE) /* Nothing to do, bail out early. */
     1321        return;
     1322
    13131323    switch (u32Event)
    13141324    {
     
    13161326        {
    13171327#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    1318             pServer->mConsole->i_getAudioVRDE()->onVRDEInputBegin(pvCtx, (PVRDEAUDIOINBEGIN)pvData);
     1328            pVRDE->onVRDEInputBegin(pvCtx, (PVRDEAUDIOINBEGIN)pvData);
    13191329#else
    13201330            const VRDEAUDIOINBEGIN *pParms = (const VRDEAUDIOINBEGIN *)pvData;
     
    13311341        case VRDE_AUDIOIN_DATA:
    13321342#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    1333             pServer->mConsole->i_getAudioVRDE()->onVRDEInputData(pvCtx, pvData, cbData);
     1343            pVRDE->onVRDEInputData(pvCtx, pvData, cbData);
    13341344#else
    13351345            pPort->pfnAudioInputEventData (pPort, pvCtx, pvData, cbData);
     
    13391349        case VRDE_AUDIOIN_END:
    13401350#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    1341             pServer->mConsole->i_getAudioVRDE()->onVRDEInputEnd(pvCtx);
     1351            pVRDE->onVRDEInputEnd(pvCtx);
    13421352#else
    13431353            pPort->pfnAudioInputEventEnd (pPort, pvCtx);
  • trunk/src/VBox/Main/src-client/DrvAudioVRDE.cpp

    r53831 r54230  
    55
    66/*
    7  * Copyright (C) 2013-2014 Oracle Corporation
     7 * Copyright (C) 2013-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5050    /** Pointer to the driver instance structure. */
    5151    PDMIHOSTAUDIO        IHostAudioR3;
     52    /** Pointer to the VRDP's console object. */
    5253    ConsoleVRDPServer   *pConsoleVRDPServer;
    53     /** Pointer to the DrvAudio port interface that is above it. */
     54    /** Pointer to the DrvAudio port interface that is above us. */
    5455    PPDMIAUDIOCONNECTOR  pDrvAudio;
     56    /** Whether this driver is enabled or not. */
     57    bool                 fEnabled;
    5558} DRVAUDIOVRDE, *PDRVAUDIOVRDE;
    5659
     
    6467    /** Critical section. */
    6568    RTCRITSECT           CritSect;
    66 
    6769} VRDESTREAMIN, *PVRDESTREAMIN;
    6870
     
    8284}
    8385
    84 static DECLCALLBACK(int) drvAudioVRDEInitOut(PPDMIHOSTAUDIO pInterface,
    85                                              PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
    86                                              uint32_t *pcSamples)
    87 {
    88     PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3);
    89     AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
    90 
    91     LogFlowFunc(("pHstStrmOut=%p, pCfg=%p\n", pHstStrmOut, pCfg));
    92 
    93     PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut;
    94     AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
    95 
    96     if (pcSamples)
    97         *pcSamples = _4K; /** @todo Make this configurable. */
    98 
    99     return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmOut->HstStrmOut.Props);
    100 }
    101 
    10286static DECLCALLBACK(int) drvAudioVRDEInitIn(PPDMIHOSTAUDIO pInterface,
    10387                                            PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
     
    11599
    116100    return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmIn->HstStrmIn.Props);
     101}
     102
     103static DECLCALLBACK(int) drvAudioVRDEInitOut(PPDMIHOSTAUDIO pInterface,
     104                                             PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
     105                                             uint32_t *pcSamples)
     106{
     107    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3);
     108    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
     109
     110    LogFlowFunc(("pHstStrmOut=%p, pCfg=%p\n", pHstStrmOut, pCfg));
     111
     112    PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut;
     113    AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
     114
     115    if (pcSamples)
     116        *pcSamples = _4K; /** @todo Make this configurable. */
     117
     118    return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmOut->HstStrmOut.Props);
     119}
     120
     121static DECLCALLBACK(bool) drvAudioVRDEIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
     122{
     123    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3);
     124    AssertPtrReturn(pDrv, false);
     125
     126    NOREF(enmDir);
     127
     128    if (!pDrv->fEnabled)
     129        return false;
     130
     131    return true;
    117132}
    118133
     
    184199    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudioR3);
    185200    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
     201
    186202    PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut;
    187203    AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
     
    311327
    312328    /* Initialize only if not already done. */
     329    int rc;
    313330    if (enmStreamCmd == PDMAUDIOSTREAMCMD_ENABLE)
    314331    {
    315         int rc2 = pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pVRDEStrmIn, audioMixBufSize(&pThisStrmIn->MixBuf),
    316                                                                 pThisStrmIn->Props.uHz,
    317                                                                 pThisStrmIn->Props.cChannels, pThisStrmIn->Props.cBits);
    318 #ifdef DEBUG
    319         if (rc2 == VERR_NOT_SUPPORTED)
     332        rc = pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pVRDEStrmIn, audioMixBufSize(&pThisStrmIn->MixBuf),
     333                                                           pThisStrmIn->Props.uHz,
     334                                                           pThisStrmIn->Props.cChannels, pThisStrmIn->Props.cBits);
     335        if (rc == VERR_NOT_SUPPORTED)
     336        {
    320337            LogFlowFunc(("No RDP client connected, so no input recording supported\n"));
    321 #endif
     338            rc = VINF_SUCCESS;
     339        }
    322340    }
    323341    else if (enmStreamCmd == PDMAUDIOSTREAMCMD_DISABLE)
    324342    {
    325343        pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL /* pvUserCtx */);
    326     }
    327 
    328     return VINF_SUCCESS;
     344        rc = VINF_SUCCESS;
     345    }
     346
     347    return rc;
    329348}
    330349
     
    334353    pCfg->cbStreamIn      = sizeof(VRDESTREAMIN);
    335354    pCfg->cMaxHstStrmsOut = 1;
    336     pCfg->cMaxHstStrmsIn  = 2; /* Microphone in + line in. */
     355    pCfg->cMaxHstStrmsIn  = 2; /* Microphone in + Line in. */
    337356
    338357    return VINF_SUCCESS;
     
    367386}
    368387
    369 int AudioVRDE::onVRDEInputIntercept(bool fIntercept)
    370 {
    371     LogFlowThisFunc(("fIntercept=%RTbool\n", fIntercept));
     388int AudioVRDE::onVRDEControl(bool fEnable, uint32_t uFlags)
     389{
     390    LogFlowThisFunc(("fEnable=%RTbool, uFlags=0x%x\n", fEnable, uFlags));
     391
     392    mpDrv->fEnabled = fEnable;
    372393
    373394    return VINF_SUCCESS; /* Never veto. */
     
    398419    bool fUnsigned = VRDE_AUDIO_FMT_SIGNED(audioFmt);
    399420
    400     /*pVRDEStrmIn->cbSample = VRDE_AUDIO_FMT_BYTES_PER_SAMPLE(audioFmt);
    401     pVRDEStrmIn->uHz      = iSampleHz;*/
    402 
    403421    LogFlowFunc(("cbSample=%RU32, iSampleHz=%d, cChannels=%d, cBits=%d, fUnsigned=%RTbool\n",
    404422                 VRDE_AUDIO_FMT_BYTES_PER_SAMPLE(audioFmt), iSampleHz, cChannels, cBits, fUnsigned));
     
    434452}
    435453
     454int AudioVRDE::onVRDEInputIntercept(bool fEnabled)
     455{
     456    return VINF_SUCCESS; /* Never veto. */
     457}
     458
    436459/**
    437460 * Construct a VRDE audio driver instance.
     
    442465DECLCALLBACK(int) AudioVRDE::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
    443466{
     467    AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
     468    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
     469
    444470    PDRVAUDIOVRDE pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVRDE);
     471
    445472    LogRel(("Audio: Initializing VRDE driver\n"));
    446473    LogFlowFunc(("fFlags=0x%x\n", fFlags));
     
    453480     * Init the static parts.
    454481     */
    455     pThis->pDrvIns                    = pDrvIns;
     482    pThis->pDrvIns                   = pDrvIns;
    456483    /* IBase */
    457     pDrvIns->IBase.pfnQueryInterface  = drvAudioVRDEQueryInterface;
     484    pDrvIns->IBase.pfnQueryInterface = drvAudioVRDEQueryInterface;
    458485    /* IHostAudioR3 */
    459     pThis->IHostAudioR3.pfnInitIn     = drvAudioVRDEInitIn;
    460     pThis->IHostAudioR3.pfnInitOut    = drvAudioVRDEInitOut;
    461     pThis->IHostAudioR3.pfnControlOut = drvAudioVRDEControlOut;
    462     pThis->IHostAudioR3.pfnControlIn  = drvAudioVRDEControlIn;
    463     pThis->IHostAudioR3.pfnFiniIn     = drvAudioVRDEFiniIn;
    464     pThis->IHostAudioR3.pfnFiniOut    = drvAudioVRDEFiniOut;
    465     pThis->IHostAudioR3.pfnCaptureIn  = drvAudioVRDECaptureIn;
    466     pThis->IHostAudioR3.pfnPlayOut    = drvAudioVRDEPlayOut;
    467     pThis->IHostAudioR3.pfnGetConf    = drvAudioVRDEGetConf;
    468     pThis->IHostAudioR3.pfnInit       = drvAudioVRDEInit;
    469 
    470     /* Get VRDPServer pointer. */
     486    PDMAUDIO_IHOSTAUDIOR3_CALLBACKS(drvAudioVRDE);
     487
     488    /* Init defaults. */
     489    pThis->fEnabled = false;
     490
     491    /*
     492     * Get the ConsoleVRDPServer object pointer.
     493     */
    471494    void *pvUser;
    472495    int rc = CFGMR3QueryPtr(pCfg, "ObjectVRDPServer", &pvUser);
     
    480503    pThis->pConsoleVRDPServer = (ConsoleVRDPServer *)pvUser;
    481504
     505    /*
     506     * Get the AudioVRDE object pointer.
     507     */
    482508    pvUser = NULL;
    483509    rc = CFGMR3QueryPtr(pCfg, "Object", &pvUser);
  • trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp

    r53442 r54230  
    55
    66/*
    7  * Copyright (C) 2014 Oracle Corporation
     7 * Copyright (C) 2014-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    808808     * Init the static parts.
    809809     */
    810     pThis->pDrvIns                    = pDrvIns;
     810    pThis->pDrvIns                   = pDrvIns;
    811811    /* IBase */
    812     pDrvIns->IBase.pfnQueryInterface  = drvAudioVideoRecQueryInterface;
    813     pThis->IHostAudioR3.pfnInitIn     = drvAudioVideoRecInitIn;
    814     pThis->IHostAudioR3.pfnInitOut    = drvAudioVideoRecInitOut;
    815     pThis->IHostAudioR3.pfnControlOut = drvAudioVideoRecControlOut;
    816     pThis->IHostAudioR3.pfnControlIn  = drvAudioVideoRecControlIn;
    817     pThis->IHostAudioR3.pfnFiniIn     = drvAudioVideoRecFiniIn;
    818     pThis->IHostAudioR3.pfnFiniOut    = drvAudioVideoRecFiniOut;
    819     pThis->IHostAudioR3.pfnCaptureIn  = drvAudioVideoRecCaptureIn;
    820     pThis->IHostAudioR3.pfnPlayOut    = drvAudioVideoRecPlayOut;
    821     pThis->IHostAudioR3.pfnGetConf    = drvAudioVideoRecGetConf;
    822     pThis->IHostAudioR3.pfnInit       = drvAudioVideoRecInit;
     812    pDrvIns->IBase.pfnQueryInterface = drvAudioVideoRecQueryInterface;
     813    /* IHostAudioR3 */
     814    PDMAUDIO_IHOSTAUDIOR3_CALLBACKS(drvAudioVideoRec);
    823815
    824816    /* Get VRDPServer pointer. */
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