VirtualBox

Changeset 70035 in vbox


Ignore:
Timestamp:
Dec 8, 2017 3:50:01 PM (7 years ago)
Author:
vboxsync
Message:

Main/VideoRec: Made the audio driver's LUN assignment more flexible by keeping the initial LUN# around when (re-)attaching the driver.

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r68975 r70035  
    213213    bool                     i_videoRecStarted(void);
    214214# ifdef VBOX_WITH_AUDIO_VIDEOREC
    215     int                      i_videoRecConfigureAudioDriver(const Utf8Str& strAdapter, unsigned uInstance, unsigned uLun, bool fAttach);
     215    int                      i_videoRecConfigureAudioDriver(const Utf8Str& strAdapter, unsigned uInstance, unsigned uLUN, bool fAttach);
    216216# endif
    217     static DECLCALLBACK(int) i_videoRecConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach);
     217    static DECLCALLBACK(int) i_videoRecConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach, unsigned *puLUN);
    218218    int                      i_videoRecSendAudio(const void *pvData, size_t cbData, uint64_t uDurationMs);
    219219    int                      i_videoRecStart(void);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r69749 r70035  
    55175517            alock.release();
    55185518
     5519            const PVIDEORECCFG pCfg = pDisplay->i_videoRecGetConfig();
     5520            const unsigned     uLUN = pCfg->Audio.uLUN; /* Get the currently configured LUN. */
     5521
    55195522            int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY /*idDstCpu*/,
    5520                                        (PFNRT)Display::i_videoRecConfigure, 3,
    5521                                        pDisplay, pDisplay->i_videoRecGetConfig(), true /* fAttachDetach */);
     5523                                       (PFNRT)Display::i_videoRecConfigure, 4,
     5524                                       pDisplay, pCfg, true /* fAttachDetach */, &pCfg->Audio.uLUN);
    55225525            if (RT_SUCCESS(vrc))
    55235526            {
    55245527                /* Make sure to acquire the lock again after we're done running in EMT. */
    55255528                alock.acquire();
     5529
     5530                /* We don't support dynamic LUNs for this stuff yet. */
     5531                Assert(uLUN == pCfg->Audio.uLUN);
    55265532
    55275533                if (!mDisplay->i_videoRecStarted())
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r70021 r70035  
    29872987            }
    29882988
    2989             uint8_t u8AudioLUN = 0;
     2989            unsigned uAudioLUN = 0;
    29902990
    29912991            BOOL fAudioEnabledIn = FALSE;
     
    29942994            hrc = audioAdapter->COMGETTER(EnabledOut)(&fAudioEnabledOut);                   H();
    29952995
    2996             CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", u8AudioLUN++);
     2996            CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN++);
    29972997            InsertConfigString(pLunL0, "Driver", "AUDIO");
    29982998
     
    30173017             * The VRDE audio backend driver.
    30183018             */
    3019             CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", u8AudioLUN++);
     3019            CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN++);
    30203020            InsertConfigString(pLunL0, "Driver", "AUDIO");
    30213021
     
    30423042                /* Note: Don't do any driver attaching (fAttachDetach) here, as this will
    30433043                 *       be done automatically as part of the VM startup process. */
    3044                 rc = pDisplay->i_videoRecConfigure(pDisplay, pDisplay->i_videoRecGetConfig(), false /* fAttachDetach */);
    3045 
    3046                 /** @todo Fix this: Figure out what the next LUN might be. */
    3047                 u8AudioLUN = 3;
     3044                rc = pDisplay->i_videoRecConfigure(pDisplay, pDisplay->i_videoRecGetConfig(), false /* fAttachDetach */,
     3045                                                   &uAudioLUN);
     3046                if (RT_SUCCESS(rc)) /* Successfully configured, use next LUN for drivers below. */
     3047                    uAudioLUN++;
    30483048            }
    30493049#endif /* VBOX_WITH_AUDIO_VIDEOREC */
     
    30553055                 * The audio debugging backend.
    30563056                 */
    3057                 CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", u8AudioLUN++);
     3057                CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN++);
    30583058                InsertConfigString(pLunL0, "Driver", "AUDIO");
    30593059
     
    30933093             * The ValidationKit backend.
    30943094             */
    3095             CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", u8AudioLUN++);
     3095            CFGMR3InsertNodeF(pInst, &pLunL0, "LUN#%RU8", uAudioLUN++);
    30963096            InsertConfigString(pLunL0, "Driver", "AUDIO");
    30973097            InsertConfigNode(pLunL0,   "Config", &pCfg);
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r69725 r70035  
    24242424 * @param   strDevice           The PDM device name.
    24252425 * @param   uInstance           The PDM device instance.
    2426  * @param   uLun                The PDM LUN number of the drive.
     2426 * @param   uLUN                The PDM LUN number of the driver.
    24272427 * @param   fAttach             Whether to attach or detach the driver configuration to CFGM.
    24282428 *
     
    24302430 */
    24312431int Display::i_videoRecConfigureAudioDriver(const Utf8Str& strDevice,
    2432                                                 unsigned       uInstance,
    2433                                                 unsigned       uLun,
    2434                                                 bool           fAttach)
     2432                                            unsigned       uInstance,
     2433                                            unsigned       uLUN,
     2434                                            bool           fAttach)
    24352435{
    24362436    if (strDevice.isEmpty()) /* No audio device configured. Bail out. */
     
    24532453    AssertPtr(pDev0);
    24542454
    2455     PCFGMNODE pDevLun = CFGMR3GetChildF(pDev0, "LUN#%u/", uLun);
     2455    PCFGMNODE pDevLun = CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN);
    24562456
    24572457    if (fAttach)
     
    24622462
    24632463            PCFGMNODE pLunL0;
    2464             CFGMR3InsertNodeF(pDev0, &pLunL0, "LUN#%RU8", uLun);
     2464            CFGMR3InsertNodeF(pDev0, &pLunL0, "LUN#%RU8", uLUN);
    24652465            CFGMR3InsertString(pLunL0, "Driver", "AUDIO");
    24662466
     
    24942494
    24952495/**
    2496  * Configures video capturing and attaches / detaches the associated driver(s).
     2496 * Configures video capturing (via CFGM) and attaches / detaches the associated driver.
     2497 * Currently this only is the audio driver (if available).
    24972498 *
    24982499 * @returns IPRT status code.
     
    25002501 * @param   pCfg                Where to store the configuration into.
    25012502 * @param   fAttachDetach       Whether to attach/detach associated drivers or not.
     2503 * @param   puLUN               On input, this defines the LUN to which the audio driver shall be assigned to.
     2504 *                              On output, this returns the LUN the audio driver was assigned to.
    25022505 */
    25032506/* static */
    2504 DECLCALLBACK(int) Display::i_videoRecConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach)
     2507DECLCALLBACK(int) Display::i_videoRecConfigure(Display *pThis, PVIDEORECCFG pCfg, bool fAttachDetach, unsigned *puLUN)
    25052508{
    25062509    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
    25072510    AssertPtrReturn(pCfg,  VERR_INVALID_POINTER);
     2511    AssertPtrReturn(puLUN, VERR_INVALID_POINTER);
    25082512
    25092513    AssertPtr(pThis->mParent);
     
    26462650    AssertComRC(rc);
    26472651
     2652    unsigned uInstance = 0;
     2653    unsigned uLUN      = *puLUN;
     2654
    26482655    Utf8Str strAudioDev = pThis->mParent->i_getAudioAdapterDeviceName(audioAdapter);
    26492656    if (!strAudioDev.isEmpty())
     
    26512658        Console::SafeVMPtr ptrVM(pThis->mParent);
    26522659        Assert(ptrVM.isOk());
    2653 
    2654         unsigned uInstance = 0;
    2655         unsigned uLun      = 2; /** @todo Make this configurable. */
    26562660
    26572661        /*
     
    26642668        if (pCfg->Audio.fEnabled) /* Enable */
    26652669        {
    2666             vrc2 = pThis->i_videoRecConfigureAudioDriver(strAudioDev, uInstance, uLun, true /* fAttach */);
     2670            vrc2 = pThis->i_videoRecConfigureAudioDriver(strAudioDev, uInstance, uLUN, true /* fAttach */);
    26672671            if (   RT_SUCCESS(vrc2)
    26682672                && fAttachDetach)
    26692673            {
    2670                 vrc2 = PDMR3DriverAttach(ptrVM.rawUVM(), strAudioDev.c_str(), uInstance, uLun, 0 /* fFlags */, NULL /* ppBase */);
     2674                vrc2 = PDMR3DriverAttach(ptrVM.rawUVM(), strAudioDev.c_str(), uInstance, uLUN, 0 /* fFlags */, NULL /* ppBase */);
    26712675            }
    26722676
     
    26772681        {
    26782682            if (fAttachDetach)
    2679                 vrc2 = PDMR3DriverDetach(ptrVM.rawUVM(), strAudioDev.c_str(), uInstance, uLun, "AUDIO",
     2683                vrc2 = PDMR3DriverDetach(ptrVM.rawUVM(), strAudioDev.c_str(), uInstance, uLUN, "AUDIO",
    26802684                                         0 /* iOccurance */, 0 /* fFlags */);
    26812685
    26822686            if (RT_SUCCESS(vrc2))
    26832687            {
    2684                 vrc2 = pThis->i_videoRecConfigureAudioDriver(strAudioDev, uInstance, uLun, false /* fAttach */);
     2688                vrc2 = pThis->i_videoRecConfigureAudioDriver(strAudioDev, uInstance, uLUN, false /* fAttach */);
    26852689            }
    26862690
     
    27102714
    27112715    }
     2716
     2717    if (puLUN)
     2718        *puLUN = uLUN;
    27122719
    27132720    return S_OK;
  • trunk/src/VBox/Main/src-client/VideoRec.h

    r68990 r70035  
    9696        /** Whether audio recording is enabled or not. */
    9797        bool                fEnabled;
     98        /** The device LUN the audio driver is attached / configured to. */
     99        unsigned            uLUN;
    98100        /** Hertz (Hz) rate. */
    99101        uint16_t            uHz;
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