VirtualBox

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


Ignore:
Timestamp:
Feb 3, 2014 7:29:26 PM (11 years ago)
Author:
vboxsync
Message:

crOpenGL/VideoRec: do hardweight screen capthure only when recorder is ready

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

Legend:

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

    r50313 r50314  
    155155    mCrOglScreenshotData.u32Screen = CRSCREEN_ALL;
    156156    mCrOglScreenshotData.pvContext = this;
    157     mCrOglScreenshotData.pfnScreenshot = displayCrVRecScreenshot;
     157    mCrOglScreenshotData.pfnScreenshotBegin = displayCrVRecScreenshotBegin;
     158    mCrOglScreenshotData.pfnScreenshotPerform = displayCrVRecScreenshotPerform;
     159    mCrOglScreenshotData.pfnScreenshotEnd = displayCrVRecScreenshotEnd;
    158160#endif
    159161
     
    42054207}
    42064208
    4207 
    4208 void  Display::handleCrVRecScreenshot(uint32_t uScreen,
     4209bool  Display::handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp)
     4210{
     4211    return VideoRecIsReady(mpVideoRecCtx, uScreen, u64TimeStamp);
     4212}
     4213
     4214void  Display::handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp)
     4215{
     4216}
     4217
     4218void  Display::handleCrVRecScreenshotPerform(uint32_t uScreen,
    42094219                uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
    42104220                uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
     
    42174227                              uGuestWidth, uGuestHeight,
    42184228                              pu8BufferAddress, u64TimeStamp);
    4219     Assert(rc == VINF_SUCCESS || rc == VERR_TRY_AGAIN || rc == VINF_TRY_AGAIN);
     4229    Assert(rc == VINF_SUCCESS/* || rc == VERR_TRY_AGAIN || rc == VINF_TRY_AGAIN*/);
    42204230}
    42214231
     
    42264236}
    42274237
    4228 DECLCALLBACK(void) Display::displayCrVRecScreenshot(void *pvCtx, uint32_t uScreen,
     4238DECLCALLBACK(void) Display::displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
    42294239                uint32_t x, uint32_t y, uint32_t uBitsPerPixel,
    42304240                uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
     
    42324242{
    42334243    Display *pDisplay = (Display *)pvCtx;
    4234     pDisplay->handleCrVRecScreenshot(uScreen,
     4244    pDisplay->handleCrVRecScreenshotPerform(uScreen,
    42354245            x, y, FramebufferPixelFormat_FOURCC_RGB, uBitsPerPixel,
    42364246            uBytesPerLine, uGuestWidth, uGuestHeight,
    42374247            pu8BufferAddress, u64TimeStamp);
     4248}
     4249
     4250DECLCALLBACK(bool) Display::displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp)
     4251{
     4252    Display *pDisplay = (Display *)pvCtx;
     4253    return pDisplay->handleCrVRecScreenshotBegin(uScreen, u64TimeStamp);
     4254}
     4255
     4256DECLCALLBACK(void) Display::displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp)
     4257{
     4258    Display *pDisplay = (Display *)pvCtx;
     4259    pDisplay->handleCrVRecScreenshotEnd(uScreen, u64TimeStamp);
    42384260}
    42394261
  • trunk/src/VBox/Main/src-client/VideoRec.cpp

    r50041 r50314  
    603603
    604604/**
     605 * VideoRec utility function to check if recording engine is ready to accept a new frame
     606 * for the given screen.
     607 *
     608 * @returns true if recording engine is ready
     609 * @param   pCtx   Pointer to video recording context.
     610 * @param   uScreen screen id.
     611 * @param   u64TimeStamp current time stamp
     612 */
     613bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t u64TimeStamp)
     614{
     615    uint32_t enmState = ASMAtomicReadU32(&g_enmState);
     616    if (enmState != VIDREC_IDLE)
     617        return false;
     618
     619    PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
     620    if (!pStrm->fEnabled)
     621        return false;
     622
     623    if (u64TimeStamp < pStrm->u64LastTimeStamp + pStrm->uDelay)
     624        return false;
     625
     626    if (ASMAtomicReadBool(&pStrm->fRgbFilled))
     627        return false;
     628
     629    return true;
     630}
     631
     632/**
    605633 * VideoRec utility function to encode the source image and write the encoded
    606634 * image to target file.
  • trunk/src/VBox/Main/src-client/VideoRec.h

    r50313 r50314  
    3434                          uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
    3535                          uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
     36bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t u64TimeStamp);
    3637
    3738#endif /* !____H_VIDEOREC */
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