VirtualBox

Changeset 105095 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Jul 2, 2024 10:06:48 AM (7 months ago)
Author:
vboxsync
Message:

Video Recording/Main: More optimizations for recording older guests which have a slightly different screen update logic. bugref:10650

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

Legend:

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

    r105006 r105095  
    205205    int i_recordingStop(util::AutoWriteLock *pAutoLock = NULL);
    206206    int i_recordingCursorShapeChange(bool fVisible, bool fAlpha, uint32_t xHot, uint32_t yHot, uint32_t uWidth, uint32_t uHeight, const uint8_t *pu8Shape, uint32_t cbShape);
     207    static DECLCALLBACK(void) s_recordingOnStateChangedCallback(RecordingContext *pCtx, RECORDINGSTS enmSts, uint32_t uScreen, int vrc, void *pvUser);
    207208# ifdef VBOX_WITH_AUDIO_RECORDING
    208209    AudioVideoRec *i_recordingGetAudioDrv(void) const { return mRecording.mAudioRec; }
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r105006 r105095  
    4646#ifdef VBOX_WITH_RECORDING
    4747# include "RecordingInternals.h"
     48class RecordingContext;
    4849#endif
    4950
     
    188189    int i_recordingStart(void);
    189190    int i_recordingStop(void);
    190     int i_recordingInvalidate(bool fForce = false);
     191    int i_recordingInvalidate(void);
    191192    int i_recordingScreenChanged(unsigned uScreenId, const DISPLAYFBINFO *pFBInfo);
    192     int i_recordingScreenUpdate(unsigned uScreenId, PRECORDINGVIDEOFRAME pFrame);
     193    int i_recordingScreenUpdate(unsigned uScreenId, uint8_t *pauFramebuffer, size_t cbFramebuffer, uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t uBytesPerLine);
     194    int i_recordingScreenUpdate(unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
    193195    int i_recordingCursorPositionChange(unsigned uScreenId, uint32_t fFlags, int32_t x, int32_t y);
    194196#endif
     
    414416
    415417#ifdef VBOX_WITH_RECORDING
    416     /* Serializes access to video recording source bitmaps. */
    417     RTCRITSECT           mVideoRecLock;
    418     /** Array which defines which screens are being enabled for recording. */
    419     bool                 maRecordingEnabled[SchemaDefs::MaxGuestMonitors];
     418    /** Struct which holds information and state about (video) recording. */
     419    struct Recording
     420    {
     421        Recording()
     422            : pCtx(NULL) { }
     423
     424        /** Recording context. Constant across lifetime.
     425         *  Might be NULL if not being used. */
     426        RecordingContext * const pCtx;
     427    } Recording;
    420428#endif
    421429
    422430#ifdef VBOX_WITH_STATISTICS
     431    /** Struct for keeping STAM values. */
    423432    struct
    424433    {
  • trunk/src/VBox/Main/include/Recording.h

    r105006 r105095  
    7171
    7272/**
     73 * Enumeration for a recording context state.
     74 */
     75enum RECORDINGSTS
     76{
     77    /** Recording not initialized. */
     78    RECORDINGSTS_UNINITIALIZED = 0,
     79    /** Recording was created. */
     80    RECORDINGSTS_CREATED       = 1,
     81    /** Recording was started. */
     82    RECORDINGSTS_STARTED       = 2,
     83    /** Recording was stopped. */
     84    RECORDINGSTS_STOPPED       = 3,
     85    /** Limit has been reached. */
     86    RECORDINGSTS_LIMIT_REACHED = 4,
     87    /** Recording experienced an error. */
     88    RECORDINGSTS_FAILURE       = 5,
     89    /** The usual 32-bit hack. */
     90    RECORDINGSTS_32BIT_HACK    = 0x7fffffff
     91};
     92
     93/**
    7394 * Class for managing a recording context.
    7495 */
    7596class RecordingContext
    7697{
     98    friend RecordingStream;
     99
     100public:
     101
     102    /** Recording context callback table. */
     103    struct CALLBACKS
     104    {
     105       /**
     106        * Recording state got changed. Optional.
     107        *
     108        * @param   pCtx                 Recording context.
     109        * @param   enmSts               New status.
     110        * @param   uScreen              Screen ID.
     111        *                               Set to UINT32_MAX if the limit of all streams was reached.
     112        * @param   vrc                  Result code of state change.
     113        * @param   pvUser               User-supplied pointer. Might be NULL.
     114        */
     115        DECLCALLBACKMEMBER(void, pfnStateChanged, (RecordingContext *pCtx, RECORDINGSTS enmSts, uint32_t uScreen, int vrc, void *pvUser));
     116
     117        /** User-supplied pointer. Might be NULL. */
     118        void *pvUser;
     119    };
     120
    77121public:
    78122
     
    108152    uint64_t GetCurrentPTS(void) const;
    109153    bool IsFeatureEnabled(RecordingFeature_T enmFeature);
     154    bool IsFeatureEnabled(uint32_t uScreen, RecordingFeature_T enmFeature);
    110155    bool IsReady(void);
    111     bool IsReady(uint32_t uScreen, uint64_t msTimestamp);
    112156    bool IsStarted(void);
    113157    bool IsLimitReached(void);
    114158    bool IsLimitReached(uint32_t uScreen, uint64_t msTimestamp);
    115159    bool NeedsUpdate(uint32_t uScreen, uint64_t msTimestamp);
    116 
    117     DECLCALLBACK(int) OnLimitReached(uint32_t uScreen, int vrc);
     160    void SetCallbacks(RecordingContext::CALLBACKS *pCallbacks, void *pvUser);
    118161
    119162    /** The state mouse cursor state.
     
    138181    int unlock(void);
    139182
     183    int onLimitReached(uint32_t uScreen, int vrc);
     184
    140185    static DECLCALLBACK(int) threadMain(RTTHREAD hThreadSelf, void *pvUser);
    141186
     
    149194
    150195protected:
    151 
    152     /**
    153      * Enumeration for a recording context state.
    154      */
    155     enum RECORDINGSTS
    156     {
    157         /** Context not initialized. */
    158         RECORDINGSTS_UNINITIALIZED = 0,
    159         /** Context was created. */
    160         RECORDINGSTS_CREATED       = 1,
    161         /** Context was started. */
    162         RECORDINGSTS_STARTED       = 2,
    163         /** The usual 32-bit hack. */
    164         RECORDINGSTS_32BIT_HACK    = 0x7fffffff
    165     };
    166196
    167197    /** Pointer to the console object. */
     
    171201    /** The current state. */
    172202    RECORDINGSTS                 m_enmState;
     203    /** Callback table. */
     204    CALLBACKS                    m_Callbacks;
    173205    /** Critical section to serialize access. */
    174206    RTCRITSECT                   m_CritSect;
  • trunk/src/VBox/Main/include/RecordingInternals.h

    r105006 r105095  
    101101    /** Pixel format. */
    102102    RECORDINGPIXELFMT enmPixelFmt;
    103     /** Bytes per scan line (stride). */
     103    /** Bytes per scan line (stride).
     104     *  Note: Does not necessarily match \a uWidth * (\a uBPP / 8). */
    104105    uint32_t          uBytesPerLine;
    105106} RECORDINGSURFACEINFO;
     
    539540PRECORDINGVIDEOFRAME RecordingVideoFrameDup(PRECORDINGVIDEOFRAME pFrame);
    540541void RecordingVideoFrameClear(PRECORDINGVIDEOFRAME pFrame);
    541 int RecordingVideoFrameBlitRawAlpha(PRECORDINGVIDEOFRAME pFrame, uint32_t uDstX, uint32_t uDstY, const uint8_t *pu8Src, size_t cbSrc, uint32_t uSrcX, uint32_t uSrcY, uint32_t uSrcWidth, uint32_t uSrcHeight, uint32_t uSrcBytesPerLine, uint8_t uSrcBPP, RECORDINGPIXELFMT enmFmt);
    542 int RecordingVideoFrameBlitRaw(PRECORDINGVIDEOFRAME pFrame, uint32_t uDstX, uint32_t uDstY, const uint8_t *pu8Src, size_t cbSrc, uint32_t uSrcX, uint32_t uSrcY, uint32_t uSrcWidth, uint32_t uSrcHeight, uint32_t uSrcBytesPerLine, uint8_t uSrcBPP, RECORDINGPIXELFMT enmFmt);
     542int RecordingVideoFrameBlitRawAlpha(PRECORDINGVIDEOFRAME pDstFrame, uint32_t uDstX, uint32_t uDstY, const uint8_t *pu8Src, size_t cbSrc, uint32_t uSrcX, uint32_t uSrcY, uint32_t uSrcWidth, uint32_t uSrcHeight, uint32_t uSrcBytesPerLine, uint8_t uSrcBPP, RECORDINGPIXELFMT enmFmt);
     543int RecordingVideoBlitRaw(uint8_t *pu8Dst, size_t cbDst, uint32_t uDstX, uint32_t uDstY, uint32_t uDstBytesPerLine, uint8_t uDstBPP, RECORDINGPIXELFMT enmDstFmt, const uint8_t *pu8Src, size_t cbSrc, uint32_t uSrcX, uint32_t uSrcY, uint32_t uSrcWidth, uint32_t uSrcHeight, uint32_t uSrcBytesPerLine, uint8_t uSrcBPP, RECORDINGPIXELFMT enmSrcFmt);
     544int RecordingVideoFrameBlitRaw(PRECORDINGVIDEOFRAME pDstFrame, uint32_t uDstX, uint32_t uDstY, const uint8_t *pu8Src, size_t cbSrc, uint32_t uSrcX, uint32_t uSrcY, uint32_t uSrcWidth, uint32_t uSrcHeight, uint32_t uSrcBytesPerLine, uint8_t uSrcBPP, RECORDINGPIXELFMT enmFmt);
    543545int RecordingVideoFrameBlitFrame(PRECORDINGVIDEOFRAME pDstFrame, uint32_t uDstX, uint32_t uDstY, PRECORDINGVIDEOFRAME pSrcFrame, uint32_t uSrcX, uint32_t uSrcY, uint32_t uSrcWidth, uint32_t uSrcHeight);
    544546
  • trunk/src/VBox/Main/include/RecordingStream.h

    r105006 r105095  
    144144
    145145    bool IsLimitReached(uint64_t msTimestamp) const;
    146     bool IsReady(void) const;
     146    bool IsFeatureEnabled(RecordingFeature_T enmFeature) const;
    147147    bool NeedsUpdate(uint64_t msTimestamp) const;
    148148
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