VirtualBox

Changeset 75287 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Nov 6, 2018 2:10:14 PM (6 years ago)
Author:
vboxsync
Message:

Capturing/Main: Bugfixes for startup.

File:
1 edited

Legend:

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

    r75276 r75287  
    56075607 * @param   pAutoLock           Pointer to auto write lock to use for attaching/detaching required driver(s) at runtime.
    56085608 */
    5609 int Console::i_videoCaptureEnable(BOOL fEnable, util::AutoWriteLock *pAutoLock)
     5609int Console::i_videoRecEnable(BOOL fEnable, util::AutoWriteLock *pAutoLock)
    56105610{
    56115611    AssertPtrReturn(pAutoLock, VERR_INVALID_POINTER);
     
    56165616    if (pDisplay)
    56175617    {
    5618         if (RT_BOOL(fEnable) != Capture.mpVideoRecCtx->IsStarted())
     5618        const bool fEnabled =    Capture.mpVideoRecCtx
     5619                              && Capture.mpVideoRecCtx->IsStarted();
     5620
     5621        if (RT_BOOL(fEnable) != fEnabled)
    56195622        {
    56205623            LogRel(("VideoRec: %s\n", fEnable ? "Enabling" : "Disabling"));
     
    56245627            if (fEnable)
    56255628            {
     5629                vrc = i_videoRecCreate();
     5630                if (RT_SUCCESS(vrc))
     5631                {
    56265632# ifdef VBOX_WITH_AUDIO_VIDEOREC
    5627                 /* Attach the video recording audio driver if required. */
    5628                 if (   Capture.mpVideoRecCtx->IsFeatureEnabled(CaptureFeature_Audio)
    5629                     && Capture.mAudioVideoRec)
    5630                 {
    5631                     vrc = Capture.mAudioVideoRec->applyConfiguration(Capture.mpVideoRecCtx->GetConfig());
    5632                     if (RT_SUCCESS(vrc))
    5633                         vrc = Capture.mAudioVideoRec->doAttachDriverViaEmt(mpUVM, pAutoLock);
    5634                 }
     5633                    /* Attach the video recording audio driver if required. */
     5634                    if (   Capture.mpVideoRecCtx->IsFeatureEnabled(CaptureFeature_Audio)
     5635                        && Capture.mAudioVideoRec)
     5636                    {
     5637                        vrc = Capture.mAudioVideoRec->applyConfiguration(Capture.mpVideoRecCtx->GetConfig());
     5638                        if (RT_SUCCESS(vrc))
     5639                            vrc = Capture.mAudioVideoRec->doAttachDriverViaEmt(mpUVM, pAutoLock);
     5640                    }
    56355641# endif
    5636                 if (   RT_SUCCESS(vrc)
    5637                     && Capture.mpVideoRecCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */
    5638                 {
    5639                     vrc = i_videoRecStart();
     5642                    if (   RT_SUCCESS(vrc)
     5643                        && Capture.mpVideoRecCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */
     5644                    {
     5645                        vrc = i_videoRecStart();
     5646                    }
    56405647                }
    56415648            }
     
    56465653                Capture.mAudioVideoRec->doDetachDriverViaEmt(mpUVM, pAutoLock);
    56475654# endif
     5655                i_videoRecDestroy();
    56485656            }
    56495657
     
    56805688        AssertComRCReturnRC(rc);
    56815689
    5682         int vrc = i_videoCaptureEnable(fEnabled, &alock);
     5690        int vrc = i_videoRecEnable(fEnabled, &alock);
    56835691        if (RT_SUCCESS(vrc))
    56845692        {
     
    68846892
    68856893#ifdef VBOX_WITH_VIDEOREC
    6886 int Console::i_videoRecLoad(settings::CaptureSettings &Settings)
     6894int Console::i_videoRecGetSettings(settings::CaptureSettings &Settings)
    68876895{
    68886896    Assert(mMachine.isNotNull());
     
    69306938
    69316939/**
     6940 * Creates the recording context.
     6941 *
     6942 * @returns IPRT status code.
     6943 */
     6944int Console::i_videoRecCreate(void)
     6945{
     6946    AssertReturn(Capture.mpVideoRecCtx == NULL, VERR_WRONG_ORDER);
     6947
     6948    int rc = VINF_SUCCESS;
     6949
     6950    try
     6951    {
     6952        Capture.mpVideoRecCtx = new CaptureContext(this);
     6953    }
     6954    catch (std::bad_alloc &)
     6955    {
     6956        return VERR_NO_MEMORY;
     6957    }
     6958    catch (int &rc2)
     6959    {
     6960        return rc2;
     6961    }
     6962
     6963    return rc;
     6964}
     6965
     6966/**
     6967 * Destroys the recording context.
     6968 */
     6969void Console::i_videoRecDestroy(void)
     6970{
     6971    if (Capture.mpVideoRecCtx)
     6972        delete Capture.mpVideoRecCtx;
     6973}
     6974
     6975/**
    69326976 * Starts capturing. Does nothing if capturing is already active.
    69336977 *
     
    69366980int Console::i_videoRecStart(void)
    69376981{
    6938     if (Capture.mpVideoRecCtx && Capture.mpVideoRecCtx->IsStarted())
     6982    AssertPtrReturn(Capture.mpVideoRecCtx, VERR_WRONG_ORDER);
     6983
     6984    if (Capture.mpVideoRecCtx->IsStarted())
    69396985        return VINF_SUCCESS;
    69406986
    69416987    LogRel(("VideoRec: Starting ...\n"));
    69426988
    6943     try
    6944     {
    6945         Capture.mpVideoRecCtx = new CaptureContext(this);
    6946     }
    6947     catch (std::bad_alloc &)
    6948     {
    6949         return VERR_NO_MEMORY;
    6950     }
    6951     catch (int &rc)
    6952     {
    6953         return rc;
    6954     }
    6955 
    69566989    settings::CaptureSettings Settings;
    6957     int rc = i_videoRecLoad(Settings);
     6990    int rc = i_videoRecGetSettings(Settings);
    69586991    if (RT_SUCCESS(rc))
    69596992    {
     
    69777010int Console::i_videoRecStop(void)
    69787011{
    6979     if (!Capture.mpVideoRecCtx || !Capture.mpVideoRecCtx->IsStarted())
     7012    AssertPtrReturn(Capture.mpVideoRecCtx, VERR_WRONG_ORDER);
     7013
     7014    if (!Capture.mpVideoRecCtx->IsStarted())
    69807015        return VINF_SUCCESS;
    69817016
     
    1009810133        if (fCaptureEnabled)
    1009910134        {
    10100             int vrc2 = pConsole->i_videoCaptureEnable(fCaptureEnabled, &alock);
     10135            int vrc2 = pConsole->i_videoRecEnable(fCaptureEnabled, &alock);
    1010110136            if (RT_SUCCESS(vrc2))
    1010210137            {
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