VirtualBox

Changeset 96324 in vbox


Ignore:
Timestamp:
Aug 19, 2022 8:15:55 AM (2 years ago)
Author:
vboxsync
Message:

Recording/Main: Renaming (use m_ prefixes for class variables).

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

Legend:

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

    r96322 r96324  
    4848    size_t GetStreamCount(void) const;
    4949#ifdef VBOX_WITH_AUDIO_RECORDING
    50     PRECORDINGCODEC GetCodecAudio(void) { return &this->CodecAudio; }
     50    PRECORDINGCODEC GetCodecAudio(void) { return &this->m_CodecAudio; }
    5151#endif
    5252
     
    118118
    119119    /** Pointer to the console object. */
    120     Console                     *pConsole;
     120    Console                     *m_pConsole;
    121121    /** Used recording configuration. */
    122122    settings::RecordingSettings  m_Settings;
    123123    /** The current state. */
    124     RECORDINGSTS                 enmState;
     124    RECORDINGSTS                 m_enmState;
    125125    /** Critical section to serialize access. */
    126     RTCRITSECT                   CritSect;
     126    RTCRITSECT                   m_CritSect;
    127127    /** Semaphore to signal the encoding worker thread. */
    128     RTSEMEVENT                   WaitEvent;
     128    RTSEMEVENT                   m_WaitEvent;
    129129    /** Shutdown indicator. */
    130     bool                         fShutdown;
     130    bool                         m_fShutdown;
    131131    /** Encoding worker thread. */
    132     RTTHREAD                     Thread;
     132    RTTHREAD                     m_Thread;
    133133    /** Vector of current recording streams.
    134134     *  Per VM screen (display) one recording stream is being used. */
    135     RecordingStreams             vecStreams;
     135    RecordingStreams             m_vecStreams;
    136136    /** Number of streams in vecStreams which currently are enabled for recording. */
    137     uint16_t                     cStreamsEnabled;
     137    uint16_t                     m_cStreamsEnabled;
    138138    /** Timestamp (in ms) of when recording has been started. */
    139     uint64_t                     tsStartMs;
     139    uint64_t                     m_tsStartMs;
    140140#ifdef VBOX_WITH_AUDIO_RECORDING
    141141    /** Audio codec to use.
     
    145145     *  all audio data of a VM will be the same for each stream at a given
    146146     *  point in time. */
    147     RECORDINGCODEC               CodecAudio;
     147    RECORDINGCODEC               m_CodecAudio;
    148148#endif /* VBOX_WITH_AUDIO_RECORDING */
    149149    /** Block map of raw common data blocks which need to get encoded first. */
    150     RecordingBlockMap            mapBlocksRaw;
     150    RecordingBlockMap            m_mapBlocksRaw;
    151151    /** Block map of encoded common blocks.
    152152     *
     
    159159     *  For now this only affects audio, e.g. all recording streams
    160160     *  need to have the same audio data at a specific point in time. */
    161     RecordingBlockMap            mapBlocksEncoded;
     161    RecordingBlockMap            m_mapBlocksEncoded;
    162162};
    163163#endif /* !MAIN_INCLUDED_Recording_h */
  • trunk/src/VBox/Main/include/RecordingStream.h

    r96322 r96324  
    125125
    126126    const settings::RecordingScreenSettings &GetConfig(void) const;
    127     uint16_t GetID(void) const { return this->uScreenID; };
     127    uint16_t GetID(void) const { return this->m_uScreenID; };
    128128#ifdef VBOX_WITH_AUDIO_RECORDING
    129     PRECORDINGCODEC GetAudioCodec(void) { return this->pCodecAudio; };
     129    PRECORDINGCODEC GetAudioCodec(void) { return this->m_pCodecAudio; };
    130130#endif
    131     PRECORDINGCODEC GetVideoCodec(void) { return &this->CodecVideo; };
     131    PRECORDINGCODEC GetVideoCodec(void) { return &this->m_CodecVideo; };
    132132
    133133    bool IsLimitReached(uint64_t msTimestamp) const;
     
    176176    RecordingContext       *m_pCtx;
    177177    /** The current state. */
    178     RECORDINGSTREAMSTATE    enmState;
     178    RECORDINGSTREAMSTATE    m_enmState;
    179179    struct
    180180    {
    181181        /** File handle to use for writing. */
    182         RTFILE              hFile;
     182        RTFILE              m_hFile;
    183183        /** Pointer to WebM writer instance being used. */
    184         WebMWriter         *pWEBM;
     184        WebMWriter         *m_pWEBM;
    185185    } File;
    186     bool                fEnabled;
     186    bool                m_fEnabled;
    187187    /** Track number of audio stream.
    188188     *  Set to UINT8_MAX if not being used. */
    189     uint8_t             uTrackAudio;
     189    uint8_t             m_uTrackAudio;
    190190    /** Track number of video stream.
    191191     *  Set to UINT8_MAX if not being used. */
    192     uint8_t             uTrackVideo;
     192    uint8_t             m_uTrackVideo;
    193193    /** Screen ID. */
    194     uint16_t            uScreenID;
     194    uint16_t            m_uScreenID;
    195195    /** Critical section to serialize access. */
    196     RTCRITSECT          CritSect;
     196    RTCRITSECT          m_CritSect;
    197197    /** Timestamp (in ms) of when recording has been started. */
    198     uint64_t            tsStartMs;
     198    uint64_t            m_tsStartMs;
    199199#ifdef VBOX_WITH_AUDIO_RECORDING
    200200    /** Pointer to audio codec instance data to use.
     
    206206     *
    207207     *  Might be NULL if not being used. */
    208     PRECORDINGCODEC     pCodecAudio;
     208    PRECORDINGCODEC     m_pCodecAudio;
    209209#endif /* VBOX_WITH_AUDIO_RECORDING */
    210210    /** Video codec instance data to use. */
    211     RECORDINGCODEC      CodecVideo;
     211    RECORDINGCODEC      m_CodecVideo;
    212212    /** Screen settings to use. */
    213213    settings::RecordingScreenSettings
    214                         ScreenSettings;
     214                        m_ScreenSettings;
    215215    /** Common set of recording (data) blocks, needed for
    216216     *  multiplexing to all recording streams. */
    217     RecordingBlockSet   Blocks;
     217    RecordingBlockSet   m_Blocks;
    218218};
    219219
  • trunk/src/VBox/Main/include/WebMWriter.h

    r96285 r96324  
    373373    {
    374374        WebMSegment(void)
    375             : tcAbsStartMs(0)
    376             , tcAbsLastWrittenMs(0)
    377             , offStart(0)
    378             , offInfo(0)
    379             , offSeekInfo(0)
    380             , offTracks(0)
    381             , offCues(0)
    382             , cClusters(0)
    383         {
    384             uTimecodeScaleFactor = VBOX_WEBM_TIMECODESCALE_FACTOR_MS;
    385 
    386             LogFunc(("Default timecode scale is: %RU64ns\n", uTimecodeScaleFactor));
     375            : m_tcAbsStartMs(0)
     376            , m_tcAbsLastWrittenMs(0)
     377            , m_offStart(0)
     378            , m_offInfo(0)
     379            , m_offSeekInfo(0)
     380            , m_offTracks(0)
     381            , m_offCues(0)
     382            , m_cClusters(0)
     383        {
     384            m_uTimecodeScaleFactor = VBOX_WEBM_TIMECODESCALE_FACTOR_MS;
     385
     386            LogFunc(("Default timecode scale is: %RU64ns\n", m_uTimecodeScaleFactor));
    387387        }
    388388
     
    399399        int init(void)
    400400        {
    401             return RTCritSectInit(&CritSect);
     401            return RTCritSectInit(&m_CritSect);
    402402        }
    403403
     
    409409            clear();
    410410
    411             RTCritSectDelete(&CritSect);
     411            RTCritSectDelete(&m_CritSect);
    412412        }
    413413
     
    417417        void clear(void)
    418418        {
    419             WebMCuePointList::iterator itCuePoint = lstCuePoints.begin();
    420             while (itCuePoint != lstCuePoints.end())
     419            WebMCuePointList::iterator itCuePoint = m_lstCuePoints.begin();
     420            while (itCuePoint != m_lstCuePoints.end())
    421421            {
    422422                WebMCuePoint *pCuePoint = (*itCuePoint);
     
    424424                delete pCuePoint;
    425425
    426                 lstCuePoints.erase(itCuePoint);
    427                 itCuePoint = lstCuePoints.begin();
     426                m_lstCuePoints.erase(itCuePoint);
     427                itCuePoint = m_lstCuePoints.begin();
    428428            }
    429429
    430             Assert(lstCuePoints.empty());
     430            Assert(m_lstCuePoints.empty());
    431431        }
    432432
    433433        /** Critical section for serializing access to this segment. */
    434         RTCRITSECT                      CritSect;
     434        RTCRITSECT                      m_CritSect;
    435435
    436436        /** The timecode scale factor of this segment. */
    437         uint64_t                        uTimecodeScaleFactor;
     437        uint64_t                        m_uTimecodeScaleFactor;
    438438
    439439        /** Absolute timecode (in ms) when starting this segment. */
    440         WebMTimecodeAbs                 tcAbsStartMs;
     440        WebMTimecodeAbs                 m_tcAbsStartMs;
    441441        /** Absolute timecode (in ms) of last write. */
    442         WebMTimecodeAbs                 tcAbsLastWrittenMs;
     442        WebMTimecodeAbs                 m_tcAbsLastWrittenMs;
    443443
    444444        /** Absolute offset (in bytes) of CurSeg. */
    445         uint64_t                        offStart;
     445        uint64_t                        m_offStart;
    446446        /** Absolute offset (in bytes) of general info. */
    447         uint64_t                        offInfo;
     447        uint64_t                        m_offInfo;
    448448        /** Absolute offset (in bytes) of seeking info. */
    449         uint64_t                        offSeekInfo;
     449        uint64_t                        m_offSeekInfo;
    450450        /** Absolute offset (in bytes) of tracks. */
    451         uint64_t                        offTracks;
     451        uint64_t                        m_offTracks;
    452452        /** Absolute offset (in bytes) of cues table. */
    453         uint64_t                        offCues;
     453        uint64_t                        m_offCues;
    454454        /** List of cue points. Needed for seeking table. */
    455         WebMCuePointList                lstCuePoints;
     455        WebMCuePointList                m_lstCuePoints;
    456456
    457457        /** Total number of clusters. */
    458         uint64_t                        cClusters;
     458        uint64_t                        m_cClusters;
    459459
    460460        /** Map of tracks.
    461461         *  The key marks the track number (*not* the UUID!). */
    462         std::map <uint8_t, WebMTrack *> mapTracks;
     462        std::map <uint8_t, WebMTrack *> m_mapTracks;
    463463
    464464        /** Current cluster which is being handled.
     
    466466         *  Note that we don't need (and shouldn't need, as this can be a *lot* of data!) a
    467467         *  list of all clusters. */
    468         WebMCluster                     CurCluster;
    469 
    470         WebMQueue                       queueBlocks;
    471 
    472     } CurSeg;
     468        WebMCluster                     m_CurCluster;
     469
     470        WebMQueue                       m_queueBlocks;
     471
     472    } m_CurSeg;
    473473
    474474    /** Audio codec to use. */
     
    542542     * @returns Number of written WebM clusters; 0 when no clusters written (empty file).
    543543     */
    544     uint64_t GetClusters(void) const { return CurSeg.cClusters; }
     544    uint64_t GetClusters(void) const { return m_CurSeg.m_cClusters; }
    545545
    546546protected:
  • trunk/src/VBox/Main/src-client/Recording.cpp

    r96323 r96324  
    6464 */
    6565RecordingContext::RecordingContext(void)
    66     : pConsole(NULL)
    67     , enmState(RECORDINGSTS_UNINITIALIZED)
    68     , cStreamsEnabled(0)
    69 {
    70     int vrc = RTCritSectInit(&this->CritSect);
     66    : m_pConsole(NULL)
     67    , m_enmState(RECORDINGSTS_UNINITIALIZED)
     68    , m_cStreamsEnabled(0)
     69{
     70    int vrc = RTCritSectInit(&m_CritSect);
    7171    if (RT_FAILURE(vrc))
    7272        throw vrc;
     
    8282 */
    8383RecordingContext::RecordingContext(Console *ptrConsole, const settings::RecordingSettings &Settings)
    84     : pConsole(NULL)
    85     , enmState(RECORDINGSTS_UNINITIALIZED)
    86     , cStreamsEnabled(0)
    87 {
    88     int vrc = RTCritSectInit(&this->CritSect);
     84    : m_pConsole(NULL)
     85    , m_enmState(RECORDINGSTS_UNINITIALIZED)
     86    , m_cStreamsEnabled(0)
     87{
     88    int vrc = RTCritSectInit(&m_CritSect);
    8989    if (RT_FAILURE(vrc))
    9090        throw vrc;
     
    9999    destroyInternal();
    100100
    101     if (RTCritSectIsInitialized(&this->CritSect))
    102         RTCritSectDelete(&this->CritSect);
     101    if (RTCritSectIsInitialized(&m_CritSect))
     102        RTCritSectDelete(&m_CritSect);
    103103}
    104104
     
    119119    for (;;)
    120120    {
    121         int vrc = RTSemEventWait(pThis->WaitEvent, RT_INDEFINITE_WAIT);
     121        int vrc = RTSemEventWait(pThis->m_WaitEvent, RT_INDEFINITE_WAIT);
    122122        AssertRCBreak(vrc);
    123123
    124         Log2Func(("Processing %zu streams\n", pThis->vecStreams.size()));
     124        Log2Func(("Processing %zu streams\n", pThis->m_vecStreams.size()));
    125125
    126126        /* Process common raw blocks (data which not has been encoded yet). */
    127         vrc = pThis->processCommonData(pThis->mapBlocksRaw, 100 /* ms timeout */);
     127        vrc = pThis->processCommonData(pThis->m_mapBlocksRaw, 100 /* ms timeout */);
    128128
    129129        /** @todo r=andy This is inefficient -- as we already wake up this thread
    130130         *               for every screen from Main, we here go again (on every wake up) through
    131131         *               all screens.  */
    132         RecordingStreams::iterator itStream = pThis->vecStreams.begin();
    133         while (itStream != pThis->vecStreams.end())
     132        RecordingStreams::iterator itStream = pThis->m_vecStreams.begin();
     133        while (itStream != pThis->m_vecStreams.end())
    134134        {
    135135            RecordingStream *pStream = (*itStream);
    136136
    137137            /* Hand-in common encoded blocks. */
    138             vrc = pStream->Process(pThis->mapBlocksEncoded);
     138            vrc = pStream->Process(pThis->m_mapBlocksEncoded);
    139139            if (RT_FAILURE(vrc))
    140140            {
     
    151151        /* Keep going in case of errors. */
    152152
    153         if (ASMAtomicReadBool(&pThis->fShutdown))
     153        if (ASMAtomicReadBool(&pThis->m_fShutdown))
    154154        {
    155155            LogFunc(("Thread is shutting down ...\n"));
     
    170170int RecordingContext::threadNotify(void)
    171171{
    172     return RTSemEventSignal(this->WaitEvent);
     172    return RTSemEventSignal(m_WaitEvent);
    173173}
    174174
     
    209209                    Frame.Audio.cbBuf = pAudioFrame->cbBuf;
    210210
    211                     vrc = recordingCodecEncode(&this->CodecAudio, &Frame, NULL, NULL);
     211                    vrc = recordingCodecEncode(&m_CodecAudio, &Frame, NULL, NULL);
    212212                    break;
    213213                }
     
    293293            pBlock->pvData      = pFrame;
    294294            pBlock->cbData      = sizeof(RECORDINGAUDIOFRAME) + cbData;
    295             pBlock->cRefs       = this->cStreamsEnabled;
     295            pBlock->cRefs       = m_cStreamsEnabled;
    296296            pBlock->msTimestamp = msTimestamp;
    297297            pBlock->uFlags      = uFlags;
     
    351351{
    352352    RecordingContext *pThis = (RecordingContext *)pvUser;
    353     return pThis->writeCommonData(pThis->mapBlocksEncoded, pCodec, pvData, cbData, msAbsPTS, uFlags);
     353    return pThis->writeCommonData(pThis->m_mapBlocksEncoded, pCodec, pvData, cbData, msAbsPTS, uFlags);
    354354}
    355355
     
    374374    Callbacks.pfnWriteData = RecordingContext::audioCodecWriteDataCallback;
    375375
    376     int vrc = recordingCodecCreateAudio(&this->CodecAudio, enmCodec);
     376    int vrc = recordingCodecCreateAudio(&m_CodecAudio, enmCodec);
    377377    if (RT_SUCCESS(vrc))
    378         vrc = recordingCodecInit(&this->CodecAudio, &Callbacks, screenSettings);
     378        vrc = recordingCodecInit(&m_CodecAudio, &Callbacks, screenSettings);
    379379
    380380    return vrc;
     
    408408#endif
    409409
    410     this->pConsole = ptrConsole;
     410    m_pConsole = ptrConsole;
    411411
    412412    settings::RecordingScreenSettingsMap::const_iterator itScreen = m_Settings.mapScreens.begin();
     
    417417        {
    418418            pStream = new RecordingStream(this, itScreen->first /* Screen ID */, itScreen->second);
    419             this->vecStreams.push_back(pStream);
     419            m_vecStreams.push_back(pStream);
    420420            if (itScreen->second.fEnabled)
    421                 this->cStreamsEnabled++;
     421                m_cStreamsEnabled++;
    422422            LogFlowFunc(("pStream=%p\n", pStream));
    423423        }
     
    438438    if (RT_SUCCESS(vrc))
    439439    {
    440         this->tsStartMs = RTTimeMilliTS();
    441         this->enmState  = RECORDINGSTS_CREATED;
    442         this->fShutdown = false;
    443 
    444         vrc = RTSemEventCreate(&this->WaitEvent);
     440        m_tsStartMs = RTTimeMilliTS();
     441        m_enmState  = RECORDINGSTS_CREATED;
     442        m_fShutdown = false;
     443
     444        vrc = RTSemEventCreate(&m_WaitEvent);
    445445        AssertRCReturn(vrc, vrc);
    446446    }
     
    459459int RecordingContext::startInternal(void)
    460460{
    461     if (this->enmState == RECORDINGSTS_STARTED)
     461    if (m_enmState == RECORDINGSTS_STARTED)
    462462        return VINF_SUCCESS;
    463463
    464     Assert(this->enmState == RECORDINGSTS_CREATED);
    465 
    466     int vrc = RTThreadCreate(&this->Thread, RecordingContext::threadMain, (void *)this, 0,
     464    Assert(m_enmState == RECORDINGSTS_CREATED);
     465
     466    int vrc = RTThreadCreate(&m_Thread, RecordingContext::threadMain, (void *)this, 0,
    467467                             RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, "Record");
    468468
    469469    if (RT_SUCCESS(vrc)) /* Wait for the thread to start. */
    470         vrc = RTThreadUserWait(this->Thread, RT_MS_30SEC /* 30s timeout */);
     470        vrc = RTThreadUserWait(m_Thread, RT_MS_30SEC /* 30s timeout */);
    471471
    472472    if (RT_SUCCESS(vrc))
    473473    {
    474474        LogRel(("Recording: Started\n"));
    475         this->enmState = RECORDINGSTS_STARTED;
     475        m_enmState = RECORDINGSTS_STARTED;
    476476    }
    477477    else
     
    488488int RecordingContext::stopInternal(void)
    489489{
    490     if (this->enmState != RECORDINGSTS_STARTED)
     490    if (m_enmState != RECORDINGSTS_STARTED)
    491491        return VINF_SUCCESS;
    492492
     
    494494
    495495    /* Set shutdown indicator. */
    496     ASMAtomicWriteBool(&this->fShutdown, true);
     496    ASMAtomicWriteBool(&m_fShutdown, true);
    497497
    498498    /* Signal the thread and wait for it to shut down. */
    499499    int vrc = threadNotify();
    500500    if (RT_SUCCESS(vrc))
    501         vrc = RTThreadWait(this->Thread, RT_MS_30SEC /* 30s timeout */, NULL);
     501        vrc = RTThreadWait(m_Thread, RT_MS_30SEC /* 30s timeout */, NULL);
    502502
    503503    lock();
     
    506506    {
    507507        LogRel(("Recording: Stopped\n"));
    508         this->enmState = RECORDINGSTS_CREATED;
     508        m_enmState = RECORDINGSTS_CREATED;
    509509    }
    510510    else
     
    524524    lock();
    525525
    526     if (this->enmState == RECORDINGSTS_UNINITIALIZED)
     526    if (m_enmState == RECORDINGSTS_UNINITIALIZED)
    527527    {
    528528        unlock();
     
    533533    AssertRCReturnVoid(vrc);
    534534
    535     vrc = RTSemEventDestroy(this->WaitEvent);
     535    vrc = RTSemEventDestroy(m_WaitEvent);
    536536    AssertRCReturnVoid(vrc);
    537537
    538     this->WaitEvent = NIL_RTSEMEVENT;
    539 
    540     RecordingStreams::iterator it = this->vecStreams.begin();
    541     while (it != this->vecStreams.end())
     538    m_WaitEvent = NIL_RTSEMEVENT;
     539
     540    RecordingStreams::iterator it = m_vecStreams.begin();
     541    while (it != m_vecStreams.end())
    542542    {
    543543        RecordingStream *pStream = (*it);
     
    549549        pStream = NULL;
    550550
    551         this->vecStreams.erase(it);
    552         it = this->vecStreams.begin();
     551        m_vecStreams.erase(it);
     552        it = m_vecStreams.begin();
    553553    }
    554554
    555555    /* Sanity. */
    556     Assert(this->vecStreams.empty());
    557     Assert(this->mapBlocksRaw.size() == 0);
    558     Assert(this->mapBlocksEncoded.size() == 0);
    559 
    560     this->enmState = RECORDINGSTS_UNINITIALIZED;
     556    Assert(m_vecStreams.empty());
     557    Assert(m_mapBlocksRaw.size() == 0);
     558    Assert(m_mapBlocksEncoded.size() == 0);
     559
     560    m_enmState = RECORDINGSTS_UNINITIALIZED;
    561561
    562562    unlock();
     
    570570const settings::RecordingSettings &RecordingContext::GetConfig(void) const
    571571{
    572     return this->m_Settings;
     572    return m_Settings;
    573573}
    574574
     
    585585    try
    586586    {
    587         pStream = this->vecStreams.at(uScreen);
     587        pStream = m_vecStreams.at(uScreen);
    588588    }
    589589    catch (std::out_of_range &)
     
    602602int RecordingContext::lock(void)
    603603{
    604     int vrc = RTCritSectEnter(&this->CritSect);
     604    int vrc = RTCritSectEnter(&m_CritSect);
    605605    AssertRC(vrc);
    606606    return vrc;
     
    614614int RecordingContext::unlock(void)
    615615{
    616     int vrc = RTCritSectLeave(&this->CritSect);
     616    int vrc = RTCritSectLeave(&m_CritSect);
    617617    AssertRC(vrc);
    618618    return vrc;
     
    637637size_t RecordingContext::GetStreamCount(void) const
    638638{
    639     return this->vecStreams.size();
     639    return m_vecStreams.size();
    640640}
    641641
     
    690690    lock();
    691691
    692     RecordingStreams::const_iterator itStream = this->vecStreams.begin();
    693     while (itStream != this->vecStreams.end())
     692    RecordingStreams::const_iterator itStream = m_vecStreams.begin();
     693    while (itStream != m_vecStreams.end())
    694694    {
    695695        if ((*itStream)->GetConfig().isFeatureEnabled(enmFeature))
     
    715715    lock();
    716716
    717     const bool fIsReady = this->enmState >= RECORDINGSTS_CREATED;
     717    const bool fIsReady = m_enmState >= RECORDINGSTS_CREATED;
    718718
    719719    unlock();
     
    737737    bool fIsReady = false;
    738738
    739     if (this->enmState != RECORDINGSTS_STARTED)
     739    if (m_enmState != RECORDINGSTS_STARTED)
    740740    {
    741741        const RecordingStream *pStream = getStreamInternal(uScreen);
     
    762762    lock();
    763763
    764     const bool fIsStarted = this->enmState == RECORDINGSTS_STARTED;
     764    const bool fIsStarted = m_enmState == RECORDINGSTS_STARTED;
    765765
    766766    unlock();
     
    778778    lock();
    779779
    780     LogFlowThisFunc(("cStreamsEnabled=%RU16\n", this->cStreamsEnabled));
    781 
    782     const bool fLimitReached = this->cStreamsEnabled == 0;
     780    LogFlowThisFunc(("cStreamsEnabled=%RU16\n", m_cStreamsEnabled));
     781
     782    const bool fLimitReached = m_cStreamsEnabled == 0;
    783783
    784784    unlock();
     
    825825    bool fNeedsUpdate = false;
    826826
    827     if (this->enmState == RECORDINGSTS_STARTED)
    828     {
    829         if (   recordingCodecIsInitialized(&CodecAudio)
    830             && recordingCodecGetWritable(&CodecAudio, msTimestamp) > 0)
     827    if (m_enmState == RECORDINGSTS_STARTED)
     828    {
     829        if (   recordingCodecIsInitialized(&m_CodecAudio)
     830            && recordingCodecGetWritable(&m_CodecAudio, msTimestamp) > 0)
    831831        {
    832832            fNeedsUpdate = true;
     
    853853    lock();
    854854
    855     Assert(this->cStreamsEnabled);
    856     this->cStreamsEnabled--;
    857 
    858     LogFlowThisFunc(("cStreamsEnabled=%RU16\n", cStreamsEnabled));
     855    Assert(m_cStreamsEnabled);
     856    m_cStreamsEnabled--;
     857
     858    LogFlowThisFunc(("cStreamsEnabled=%RU16\n", m_cStreamsEnabled));
    859859
    860860    unlock();
     
    874874{
    875875#ifdef VBOX_WITH_AUDIO_RECORDING
    876     return writeCommonData(this->mapBlocksRaw, &this->CodecAudio,
     876    return writeCommonData(m_mapBlocksRaw, &m_CodecAudio,
    877877                           pvData, cbData, msTimestamp, RECORDINGCODEC_ENC_F_BLOCK_IS_KEY);
    878878#else
  • trunk/src/VBox/Main/src-client/RecordingStream.cpp

    r96323 r96324  
    3838
    3939RecordingStream::RecordingStream(RecordingContext *a_pCtx, uint32_t uScreen, const settings::RecordingScreenSettings &Settings)
    40     : enmState(RECORDINGSTREAMSTATE_UNINITIALIZED)
     40    : m_enmState(RECORDINGSTREAMSTATE_UNINITIALIZED)
    4141{
    4242    int vrc2 = initInternal(a_pCtx, uScreen, Settings);
     
    8585            char *pszFile = NULL;
    8686
    87             vrc = RTStrAPrintf(&pszFile, "%s-%u%s", pszAbsPath, this->uScreenID, pszSuff);
     87            vrc = RTStrAPrintf(&pszFile, "%s-%u%s", pszAbsPath, m_uScreenID, pszSuff);
    8888            if (RT_SUCCESS(vrc))
    8989            {
     
    113113                                       pszAbsPath, time.i32Year, time.u8Month, time.u8MonthDay,
    114114                                       time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond,
    115                                        this->uScreenID, pszSuff);
     115                                       m_uScreenID, pszSuff);
    116116                    if (RT_SUCCESS(vrc))
    117117                        vrc = RTFileOpen(&hFile, pszFile, fOpen);
     
    125125                try
    126126                {
    127                     Assert(File.pWEBM == NULL);
    128                     File.pWEBM = new WebMWriter();
     127                    Assert(File.m_pWEBM == NULL);
     128                    File.m_pWEBM = new WebMWriter();
    129129                }
    130130                catch (std::bad_alloc &)
     
    135135                if (RT_SUCCESS(vrc))
    136136                {
    137                     this->File.hFile = hFile;
    138                     this->ScreenSettings.File.strName = pszFile;
     137                    this->File.m_hFile = hFile;
     138                    m_ScreenSettings.File.strName = pszFile;
    139139                }
    140140            }
     
    146146            {
    147147                LogRel(("Recording: Failed to open file '%s' for screen %RU32, vrc=%Rrc\n",
    148                         pszFile ? pszFile : "<Unnamed>", this->uScreenID, vrc));
     148                        pszFile ? pszFile : "<Unnamed>", m_uScreenID, vrc));
    149149            }
    150150
     
    169169const settings::RecordingScreenSettings &RecordingStream::GetConfig(void) const
    170170{
    171     return this->ScreenSettings;
     171    return m_ScreenSettings;
    172172}
    173173
     
    181181{
    182182    LogFlowThisFunc(("msTimestamp=%RU64, ulMaxTimeS=%RU32, tsStartMs=%RU64\n",
    183                      msTimestamp, this->ScreenSettings.ulMaxTimeS, this->tsStartMs));
    184 
    185     if (   this->ScreenSettings.ulMaxTimeS
    186         && msTimestamp >= this->tsStartMs + (this->ScreenSettings.ulMaxTimeS * RT_MS_1SEC))
     183                     msTimestamp, m_ScreenSettings.ulMaxTimeS, m_tsStartMs));
     184
     185    if (   m_ScreenSettings.ulMaxTimeS
     186        && msTimestamp >= m_tsStartMs + (m_ScreenSettings.ulMaxTimeS * RT_MS_1SEC))
    187187    {
    188188        LogRel(("Recording: Time limit for stream #%RU16 has been reached (%RU32s)\n",
    189                 this->uScreenID, this->ScreenSettings.ulMaxTimeS));
     189                m_uScreenID, m_ScreenSettings.ulMaxTimeS));
    190190        return true;
    191191    }
    192192
    193     if (this->ScreenSettings.enmDest == RecordingDestination_File)
    194     {
    195         if (this->ScreenSettings.File.ulMaxSizeMB)
    196         {
    197             uint64_t sizeInMB = this->File.pWEBM->GetFileSize() / _1M;
    198             if(sizeInMB >= this->ScreenSettings.File.ulMaxSizeMB)
     193    if (m_ScreenSettings.enmDest == RecordingDestination_File)
     194    {
     195        if (m_ScreenSettings.File.ulMaxSizeMB)
     196        {
     197            uint64_t sizeInMB = this->File.m_pWEBM->GetFileSize() / _1M;
     198            if(sizeInMB >= m_ScreenSettings.File.ulMaxSizeMB)
    199199            {
    200200                LogRel(("Recording: File size limit for stream #%RU16 has been reached (%RU64MB)\n",
    201                         this->uScreenID, this->ScreenSettings.File.ulMaxSizeMB));
     201                        m_uScreenID, m_ScreenSettings.File.ulMaxSizeMB));
    202202                return true;
    203203            }
     
    205205
    206206        /* Check for available free disk space */
    207         if (   this->File.pWEBM
    208             && this->File.pWEBM->GetAvailableSpace() < 0x100000) /** @todo r=andy WTF? Fix this. */
     207        if (   this->File.m_pWEBM
     208            && this->File.m_pWEBM->GetAvailableSpace() < 0x100000) /** @todo r=andy WTF? Fix this. */
    209209        {
    210210            LogRel(("Recording: Not enough free storage space available, stopping recording\n"));
     
    225225int RecordingStream::iterateInternal(uint64_t msTimestamp)
    226226{
    227     if (!this->fEnabled)
     227    if (!m_fEnabled)
    228228        return VINF_SUCCESS;
    229229
     
    237237        vrc = VINF_SUCCESS;
    238238
    239     AssertPtr(this->m_pCtx);
     239    AssertPtr(m_pCtx);
    240240
    241241    switch (vrc)
     
    243243        case VINF_RECORDING_LIMIT_REACHED:
    244244        {
    245             this->fEnabled = false;
    246 
    247             int vrc2 = this->m_pCtx->OnLimitReached(this->uScreenID, VINF_SUCCESS /* rc */);
     245            m_fEnabled = false;
     246
     247            int vrc2 = m_pCtx->OnLimitReached(m_uScreenID, VINF_SUCCESS /* rc */);
    248248            AssertRC(vrc2);
    249249            break;
     
    279279bool RecordingStream::IsReady(void) const
    280280{
    281     return this->fEnabled;
     281    return m_fEnabled;
    282282}
    283283
     
    290290bool RecordingStream::NeedsUpdate(uint64_t msTimestamp) const
    291291{
    292     return recordingCodecGetWritable((const PRECORDINGCODEC)&CodecVideo, msTimestamp) > 0;
     292    return recordingCodecGetWritable((const PRECORDINGCODEC)&m_CodecVideo, msTimestamp) > 0;
    293293}
    294294
     
    309309    lock();
    310310
    311     if (!this->ScreenSettings.fEnabled)
     311    if (!m_ScreenSettings.fEnabled)
    312312    {
    313313        unlock();
     
    317317    int vrc = VINF_SUCCESS;
    318318
    319     RecordingBlockMap::iterator itStreamBlocks = Blocks.Map.begin();
    320     while (itStreamBlocks != Blocks.Map.end())
     319    RecordingBlockMap::iterator itStreamBlocks = m_Blocks.Map.begin();
     320    while (itStreamBlocks != m_Blocks.Map.end())
    321321    {
    322322        uint64_t const   msTimestamp = itStreamBlocks->first;
     
    338338                    Frame.msTimestamp = msTimestamp;
    339339
    340                     int vrc2 = recordingCodecEncode(&this->CodecVideo, &Frame, NULL, NULL);
     340                    int vrc2 = recordingCodecEncode(&m_CodecVideo, &Frame, NULL, NULL);
    341341                    AssertRC(vrc2);
    342342                    if (RT_SUCCESS(vrc))
     
    358358        delete pBlocks;
    359359
    360         Blocks.Map.erase(itStreamBlocks);
    361         itStreamBlocks = Blocks.Map.begin();
     360        m_Blocks.Map.erase(itStreamBlocks);
     361        itStreamBlocks = m_Blocks.Map.begin();
    362362    }
    363363
    364364#ifdef VBOX_WITH_AUDIO_RECORDING
    365365    /* Do we need to multiplex the common audio data to this stream? */
    366     if (this->ScreenSettings.isFeatureEnabled(RecordingFeature_Audio))
     366    if (m_ScreenSettings.isFeatureEnabled(RecordingFeature_Audio))
    367367    {
    368368        /* As each (enabled) screen has to get the same audio data, look for common (audio) data which needs to be
     
    384384                        Assert(pAudioFrame->cbBuf);
    385385
    386                         AssertPtr(this->File.pWEBM);
    387                         int vrc2 = this->File.pWEBM->WriteBlock(this->uTrackAudio, pAudioFrame->pvBuf, pAudioFrame->cbBuf, pBlockCommon->msTimestamp, pBlockCommon->uFlags);
     386                        AssertPtr(this->File.m_pWEBM);
     387                        int vrc2 = this->File.m_pWEBM->WriteBlock(m_uTrackAudio, pAudioFrame->pvBuf, pAudioFrame->cbBuf, pBlockCommon->msTimestamp, pBlockCommon->uFlags);
    388388                        AssertRC(vrc2);
    389389                        if (RT_SUCCESS(vrc))
     
    489489    do
    490490    {
    491         int xDiff = ((int)this->ScreenSettings.Video.ulWidth - (int)uSrcWidth) / 2;
     491        int xDiff = ((int)m_ScreenSettings.Video.ulWidth - (int)uSrcWidth) / 2;
    492492        uint32_t w = uSrcWidth;
    493493        if ((int)w + xDiff + (int)x <= 0)  /* Nothing visible. */
     
    508508
    509509        uint32_t h = uSrcHeight;
    510         int yDiff = ((int)this->ScreenSettings.Video.ulHeight - (int)uSrcHeight) / 2;
     510        int yDiff = ((int)m_ScreenSettings.Video.ulHeight - (int)uSrcHeight) / 2;
    511511        if ((int)h + yDiff + (int)y <= 0)  /* Nothing visible. */
    512512        {
     
    525525            destY = y + yDiff;
    526526
    527         if (   destX > this->ScreenSettings.Video.ulWidth
    528             || destY > this->ScreenSettings.Video.ulHeight)
     527        if (   destX > m_ScreenSettings.Video.ulWidth
     528            || destY > m_ScreenSettings.Video.ulHeight)
    529529        {
    530530            vrc = VERR_INVALID_PARAMETER;  /* Nothing visible. */
     
    532532        }
    533533
    534         if (destX + w > this->ScreenSettings.Video.ulWidth)
    535             w = this->ScreenSettings.Video.ulWidth - destX;
    536 
    537         if (destY + h > this->ScreenSettings.Video.ulHeight)
    538             h = this->ScreenSettings.Video.ulHeight - destY;
     534        if (destX + w > m_ScreenSettings.Video.ulWidth)
     535            w = m_ScreenSettings.Video.ulWidth - destX;
     536
     537        if (destY + h > m_ScreenSettings.Video.ulHeight)
     538            h = m_ScreenSettings.Video.ulHeight - destY;
    539539
    540540        pFrame = (PRECORDINGVIDEOFRAME)RTMemAllocZ(sizeof(RECORDINGVIDEOFRAME));
     
    564564            AssertMsgFailedBreakStmt(("Unknown pixel format (%RU32)\n", uPixelFormat), vrc = VERR_NOT_SUPPORTED);
    565565
    566         const size_t cbRGBBuf =   this->ScreenSettings.Video.ulWidth
    567                                 * this->ScreenSettings.Video.ulHeight
     566        const size_t cbRGBBuf =   m_ScreenSettings.Video.ulWidth
     567                                * m_ScreenSettings.Video.ulHeight
    568568                                * uBytesPerPixel;
    569569        AssertBreakStmt(cbRGBBuf, vrc = VERR_INVALID_PARAMETER);
     
    577577        /* If the current video frame is smaller than video resolution we're going to encode,
    578578         * clear the frame beforehand to prevent artifacts. */
    579         if (   uSrcWidth  < this->ScreenSettings.Video.ulWidth
    580             || uSrcHeight < this->ScreenSettings.Video.ulHeight)
     579        if (   uSrcWidth  < m_ScreenSettings.Video.ulWidth
     580            || uSrcHeight < m_ScreenSettings.Video.ulHeight)
    581581        {
    582582            RT_BZERO(pFrame->pu8RGBBuf, pFrame->cbRGBBuf);
     
    585585        /* Calculate start offset in source and destination buffers. */
    586586        uint32_t offSrc = y * uBytesPerLine + x * uBytesPerPixel;
    587         uint32_t offDst = (destY * this->ScreenSettings.Video.ulWidth + destX) * uBytesPerPixel;
     587        uint32_t offDst = (destY * m_ScreenSettings.Video.ulWidth + destX) * uBytesPerPixel;
    588588
    589589#ifdef VBOX_RECORDING_DUMP
     
    607607
    608608        char szFileName[RTPATH_MAX];
    609         RTStrPrintf2(szFileName, sizeof(szFileName), "/tmp/VideoRecFrame-%RU32.bmp", this->uScreenID);
     609        RTStrPrintf2(szFileName, sizeof(szFileName), "/tmp/VideoRecFrame-%RU32.bmp", m_uScreenID);
    610610
    611611        RTFILE fh;
     
    625625            /* Overflow check. */
    626626            Assert(offSrc + w * uBytesPerPixel <= uSrcHeight * uBytesPerLine);
    627             Assert(offDst + w * uBytesPerPixel <= this->ScreenSettings.Video.ulHeight * this->ScreenSettings.Video.ulWidth * uBytesPerPixel);
     627            Assert(offDst + w * uBytesPerPixel <= m_ScreenSettings.Video.ulHeight * m_ScreenSettings.Video.ulWidth * uBytesPerPixel);
    628628
    629629            memcpy(pFrame->pu8RGBBuf + offDst, puSrcData + offSrc, w * uBytesPerPixel);
     
    634634#endif
    635635            offSrc += uBytesPerLine;
    636             offDst += this->ScreenSettings.Video.ulWidth * uBytesPerPixel;
     636            offDst += m_ScreenSettings.Video.ulWidth * uBytesPerPixel;
    637637        }
    638638
     
    660660                pRecordingBlocks->List.push_back(pBlock);
    661661
    662                 Assert(this->Blocks.Map.find(msTimestamp) == this->Blocks.Map.end());
    663                 this->Blocks.Map.insert(std::make_pair(msTimestamp, pRecordingBlocks));
     662                Assert(m_Blocks.Map.find(msTimestamp) == m_Blocks.Map.end());
     663                m_Blocks.Map.insert(std::make_pair(msTimestamp, pRecordingBlocks));
    664664            }
    665665            catch (const std::exception &ex)
     
    708708                                  const settings::RecordingScreenSettings &screenSettings)
    709709{
    710     AssertReturn(enmState == RECORDINGSTREAMSTATE_UNINITIALIZED, VERR_WRONG_ORDER);
    711 
    712     this->m_pCtx         = pCtx;
    713     this->uTrackAudio    = UINT8_MAX;
    714     this->uTrackVideo    = UINT8_MAX;
    715     this->tsStartMs      = 0;
    716     this->uScreenID      = uScreen;
     710    AssertReturn(m_enmState == RECORDINGSTREAMSTATE_UNINITIALIZED, VERR_WRONG_ORDER);
     711
     712    m_pCtx         = pCtx;
     713    m_uTrackAudio    = UINT8_MAX;
     714    m_uTrackVideo    = UINT8_MAX;
     715    m_tsStartMs      = 0;
     716    m_uScreenID      = uScreen;
    717717#ifdef VBOX_WITH_AUDIO_RECORDING
    718718    /* We use the codec from the recording context, as this stream only receives multiplexed data (same audio for all streams). */
    719     this->pCodecAudio    = m_pCtx->GetCodecAudio();
    720 #endif
    721     this->ScreenSettings = screenSettings;
    722 
    723     settings::RecordingScreenSettings *pSettings = &this->ScreenSettings;
    724 
    725     int vrc = RTCritSectInit(&this->CritSect);
     719    m_pCodecAudio    = m_pCtx->GetCodecAudio();
     720#endif
     721    m_ScreenSettings = screenSettings;
     722
     723    settings::RecordingScreenSettings *pSettings = &m_ScreenSettings;
     724
     725    int vrc = RTCritSectInit(&m_CritSect);
    726726    if (RT_FAILURE(vrc))
    727727        return vrc;
    728728
    729     this->File.pWEBM = NULL;
    730     this->File.hFile = NIL_RTFILE;
     729    this->File.m_pWEBM = NULL;
     730    this->File.m_hFile = NIL_RTFILE;
    731731
    732732    vrc = open(*pSettings);
     
    751751            const char *pszFile = pSettings->File.strName.c_str();
    752752
    753             AssertPtr(File.pWEBM);
    754             vrc = File.pWEBM->OpenEx(pszFile, &this->File.hFile,
     753            AssertPtr(File.m_pWEBM);
     754            vrc = File.m_pWEBM->OpenEx(pszFile, &this->File.m_hFile,
    755755                                     fAudioEnabled ? pSettings->Audio.enmCodec : RecordingAudioCodec_None,
    756756                                     fVideoEnabled ? pSettings->Video.enmCodec : RecordingVideoCodec_None);
     
    763763            if (fVideoEnabled)
    764764            {
    765                 vrc = this->File.pWEBM->AddVideoTrack(&this->CodecVideo,
     765                vrc = this->File.m_pWEBM->AddVideoTrack(&m_CodecVideo,
    766766                                                      pSettings->Video.ulWidth, pSettings->Video.ulHeight, pSettings->Video.ulFPS,
    767                                                       &this->uTrackVideo);
     767                                                      &m_uTrackVideo);
    768768                if (RT_FAILURE(vrc))
    769769                {
     
    773773
    774774                LogRel(("Recording: Recording video of screen #%u with %RU32x%RU32 @ %RU32 kbps, %RU32 FPS (track #%RU8)\n",
    775                         this->uScreenID, pSettings->Video.ulWidth, pSettings->Video.ulHeight,
    776                         pSettings->Video.ulRate, pSettings->Video.ulFPS, this->uTrackVideo));
     775                        m_uScreenID, pSettings->Video.ulWidth, pSettings->Video.ulHeight,
     776                        pSettings->Video.ulRate, pSettings->Video.ulFPS, m_uTrackVideo));
    777777            }
    778778
     
    780780            if (fAudioEnabled)
    781781            {
    782                 AssertPtr(this->pCodecAudio);
    783                 vrc = this->File.pWEBM->AddAudioTrack(this->pCodecAudio,
     782                AssertPtr(m_pCodecAudio);
     783                vrc = this->File.m_pWEBM->AddAudioTrack(m_pCodecAudio,
    784784                                                      pSettings->Audio.uHz, pSettings->Audio.cChannels, pSettings->Audio.cBits,
    785                                                       &this->uTrackAudio);
     785                                                      &m_uTrackAudio);
    786786                if (RT_FAILURE(vrc))
    787787                {
     
    791791
    792792                LogRel(("Recording: Recording audio of screen #%u in %RU16Hz, %RU8 bit, %RU8 %s (track #%RU8)\n",
    793                         this->uScreenID, pSettings->Audio.uHz, pSettings->Audio.cBits, pSettings->Audio.cChannels,
    794                         pSettings->Audio.cChannels ? "channels" : "channel", this->uTrackAudio));
     793                        m_uScreenID, pSettings->Audio.uHz, pSettings->Audio.cBits, pSettings->Audio.cChannels,
     794                        pSettings->Audio.cChannels ? "channels" : "channel", m_uTrackAudio));
    795795            }
    796796#endif
     
    813813                }
    814814#endif
    815                 LogRel(("Recording: Recording %s of screen #%u to '%s'\n", szWhat, this->uScreenID, pszFile));
     815                LogRel(("Recording: Recording %s of screen #%u to '%s'\n", szWhat, m_uScreenID, pszFile));
    816816            }
    817817
     
    827827    if (RT_SUCCESS(vrc))
    828828    {
    829         this->enmState  = RECORDINGSTREAMSTATE_INITIALIZED;
    830         this->fEnabled  = true;
    831         this->tsStartMs = RTTimeProgramMilliTS();
     829        m_enmState  = RECORDINGSTREAMSTATE_INITIALIZED;
     830        m_fEnabled  = true;
     831        m_tsStartMs = RTTimeProgramMilliTS();
    832832
    833833        return VINF_SUCCESS;
     
    852852    int vrc = VINF_SUCCESS;
    853853
    854     switch (this->ScreenSettings.enmDest)
     854    switch (m_ScreenSettings.enmDest)
    855855    {
    856856        case RecordingDestination_File:
    857857        {
    858             if (this->File.pWEBM)
    859                 vrc = this->File.pWEBM->Close();
     858            if (this->File.m_pWEBM)
     859                vrc = this->File.m_pWEBM->Close();
    860860            break;
    861861        }
     
    866866    }
    867867
    868     this->Blocks.Clear();
    869 
    870     LogRel(("Recording: Recording screen #%u stopped\n", this->uScreenID));
     868    m_Blocks.Clear();
     869
     870    LogRel(("Recording: Recording screen #%u stopped\n", m_uScreenID));
    871871
    872872    if (RT_FAILURE(vrc))
    873873    {
    874         LogRel(("Recording: Error stopping recording screen #%u, vrc=%Rrc\n", this->uScreenID, vrc));
     874        LogRel(("Recording: Error stopping recording screen #%u, vrc=%Rrc\n", m_uScreenID, vrc));
    875875        return vrc;
    876876    }
    877877
    878     switch (this->ScreenSettings.enmDest)
     878    switch (m_ScreenSettings.enmDest)
    879879    {
    880880        case RecordingDestination_File:
    881881        {
    882             if (RTFileIsValid(this->File.hFile))
    883             {
    884                 vrc = RTFileClose(this->File.hFile);
     882            if (RTFileIsValid(this->File.m_hFile))
     883            {
     884                vrc = RTFileClose(this->File.m_hFile);
    885885                if (RT_SUCCESS(vrc))
    886886                {
    887                     LogRel(("Recording: Closed file '%s'\n", this->ScreenSettings.File.strName.c_str()));
     887                    LogRel(("Recording: Closed file '%s'\n", m_ScreenSettings.File.strName.c_str()));
    888888                }
    889889                else
    890890                {
    891                     LogRel(("Recording: Error closing file '%s', rc=%Rrc\n", this->ScreenSettings.File.strName.c_str(), vrc));
     891                    LogRel(("Recording: Error closing file '%s', rc=%Rrc\n", m_ScreenSettings.File.strName.c_str(), vrc));
    892892                    break;
    893893                }
    894894            }
    895895
    896             WebMWriter *pWebMWriter = this->File.pWEBM;
     896            WebMWriter *pWebMWriter = this->File.m_pWEBM;
    897897            AssertPtr(pWebMWriter);
    898898
     
    902902                if (pWebMWriter->GetClusters() == 0)
    903903                {
    904                     int vrc2 = RTFileDelete(this->ScreenSettings.File.strName.c_str());
     904                    int vrc2 = RTFileDelete(m_ScreenSettings.File.strName.c_str());
    905905                    AssertRC(vrc2); /* Ignore rc on non-debug builds. */
    906906                }
     
    909909                pWebMWriter = NULL;
    910910
    911                 this->File.pWEBM = NULL;
     911                this->File.m_pWEBM = NULL;
    912912            }
    913913            break;
     
    940940int RecordingStream::uninitInternal(void)
    941941{
    942     if (this->enmState != RECORDINGSTREAMSTATE_INITIALIZED)
     942    if (m_enmState != RECORDINGSTREAMSTATE_INITIALIZED)
    943943        return VINF_SUCCESS;
    944944
     
    948948
    949949#ifdef VBOX_WITH_AUDIO_RECORDING
    950     this->pCodecAudio = NULL;
    951 #endif
    952 
    953     if (this->ScreenSettings.isFeatureEnabled(RecordingFeature_Video))
    954     {
    955         vrc = recordingCodecFinalize(&this->CodecVideo);
     950    m_pCodecAudio = NULL;
     951#endif
     952
     953    if (m_ScreenSettings.isFeatureEnabled(RecordingFeature_Video))
     954    {
     955        vrc = recordingCodecFinalize(&m_CodecVideo);
    956956        if (RT_SUCCESS(vrc))
    957             vrc = recordingCodecDestroy(&this->CodecVideo);
     957            vrc = recordingCodecDestroy(&m_CodecVideo);
    958958    }
    959959
    960960    if (RT_SUCCESS(vrc))
    961961    {
    962         RTCritSectDelete(&this->CritSect);
    963 
    964         this->enmState = RECORDINGSTREAMSTATE_UNINITIALIZED;
    965         this->fEnabled = false;
     962        RTCritSectDelete(&m_CritSect);
     963
     964        m_enmState = RECORDINGSTREAMSTATE_UNINITIALIZED;
     965        m_fEnabled = false;
    966966    }
    967967
     
    982982                                      uint64_t msAbsPTS, uint32_t uFlags)
    983983{
    984     AssertPtr(this->File.pWEBM);
     984    AssertPtr(this->File.m_pWEBM);
    985985    AssertPtr(pvData);
    986986    Assert   (cbData);
     
    999999    }
    10001000
    1001     return this->File.pWEBM->WriteBlock(  pCodec->Parms.enmType == RECORDINGCODECTYPE_AUDIO
    1002                                         ? this->uTrackAudio : this->uTrackVideo,
     1001    return this->File.m_pWEBM->WriteBlock(  pCodec->Parms.enmType == RECORDINGCODECTYPE_AUDIO
     1002                                        ? m_uTrackAudio : m_uTrackVideo,
    10031003                                        pvData, cbData, msAbsPTS, blockFlags);
    10041004}
     
    10401040    AssertReturn(screenSettings.Video.ulFPS,    VERR_INVALID_PARAMETER);
    10411041
    1042     PRECORDINGCODEC pCodec = &this->CodecVideo;
     1042    PRECORDINGCODEC pCodec = &m_CodecVideo;
    10431043
    10441044    RECORDINGCODECCALLBACKS Callbacks;
     
    10611061void RecordingStream::lock(void)
    10621062{
    1063     int vrc = RTCritSectEnter(&CritSect);
     1063    int vrc = RTCritSectEnter(&m_CritSect);
    10641064    AssertRC(vrc);
    10651065}
     
    10701070void RecordingStream::unlock(void)
    10711071{
    1072     int vrc = RTCritSectLeave(&CritSect);
     1072    int vrc = RTCritSectLeave(&m_CritSect);
    10731073    AssertRC(vrc);
    10741074}
  • trunk/src/VBox/Main/src-client/WebMWriter.cpp

    r96285 r96324  
    123123
    124124    /* Make sure to drain all queues. */
    125     processQueue(&CurSeg.queueBlocks, true /* fForce */);
     125    processQueue(&m_CurSeg.m_queueBlocks, true /* fForce */);
    126126
    127127    writeFooter();
    128128
    129     WebMTracks::iterator itTrack = CurSeg.mapTracks.begin();
    130     while (itTrack != CurSeg.mapTracks.end())
     129    WebMTracks::iterator itTrack = m_CurSeg.m_mapTracks.begin();
     130    while (itTrack != m_CurSeg.m_mapTracks.end())
    131131    {
    132132        WebMTrack *pTrack = itTrack->second;
     
    134134            delete pTrack;
    135135
    136         CurSeg.mapTracks.erase(itTrack);
    137 
    138         itTrack = CurSeg.mapTracks.begin();
    139     }
    140 
    141     Assert(CurSeg.queueBlocks.Map.size() == 0);
    142     Assert(CurSeg.mapTracks.size() == 0);
     136        m_CurSeg.m_mapTracks.erase(itTrack);
     137
     138        itTrack = m_CurSeg.m_mapTracks.begin();
     139    }
     140
     141    Assert(m_CurSeg.m_queueBlocks.Map.size() == 0);
     142    Assert(m_CurSeg.m_mapTracks.size() == 0);
    143143
    144144    com::Utf8Str strFileName = getFileName().c_str();
     
    169169    /* Some players (e.g. Firefox with Nestegg) rely on track numbers starting at 1.
    170170     * Using a track number 0 will show those files as being corrupted. */
    171     const uint8_t uTrack = (uint8_t)CurSeg.mapTracks.size() + 1;
     171    const uint8_t uTrack = (uint8_t)m_CurSeg.m_mapTracks.size() + 1;
    172172
    173173    subStart(MkvElem_TrackEntry);
     
    287287                 pTrack->uTrack, pTrack->Audio.uHz, pTrack->Audio.msPerBlock, pTrack->Audio.framesPerBlock));
    288288
    289         CurSeg.mapTracks[uTrack] = pTrack;
     289        m_CurSeg.m_mapTracks[uTrack] = pTrack;
    290290
    291291        if (puTrack)
     
    319319    /* Some players (e.g. Firefox with Nestegg) rely on track numbers starting at 1.
    320320     * Using a track number 0 will show those files as being corrupted. */
    321     const uint8_t uTrack = (uint8_t)CurSeg.mapTracks.size() + 1;
     321    const uint8_t uTrack = (uint8_t)m_CurSeg.m_mapTracks.size() + 1;
    322322
    323323    subStart(MkvElem_TrackEntry);
     
    345345    LogRel2(("Recording: WebM track #%RU8: Video\n", pTrack->uTrack));
    346346
    347     CurSeg.mapTracks[uTrack] = pTrack;
     347    m_CurSeg.m_mapTracks[uTrack] = pTrack;
    348348
    349349    if (puTrack)
     
    406406    m_enmVideoCodec = enmVideoCodec;
    407407
    408     return CurSeg.init();
     408    return m_CurSeg.init();
    409409}
    410410
     
    414414void WebMWriter::destroy(void)
    415415{
    416     CurSeg.uninit();
     416    m_CurSeg.uninit();
    417417}
    418418
     
    439439
    440440    /* Save offset of current segment. */
    441     CurSeg.offStart = RTFileTell(getFile());
     441    m_CurSeg.m_offStart = RTFileTell(getFile());
    442442
    443443    writeSeekHeader();
    444444
    445445    /* Save offset of upcoming tracks segment. */
    446     CurSeg.offTracks = RTFileTell(getFile());
     446    m_CurSeg.m_offTracks = RTFileTell(getFile());
    447447
    448448    /* The tracks segment starts right after this header. */
     
    463463{
    464464#ifdef LOG_ENABLED
    465     WebMCluster &Cluster = CurSeg.CurCluster;
     465    WebMCluster &Cluster = m_CurSeg.m_CurCluster;
    466466
    467467    Log3Func(("[T%RU8C%RU64] Off=%RU64, AbsPTSMs=%RU64, RelToClusterMs=%RU16, %zu bytes\n",
     
    508508
    509509        /* See if we already have an entry for the specified timecode in our queue. */
    510         WebMBlockMap::iterator itQueue = CurSeg.queueBlocks.Map.find(tcAbsPTS);
    511         if (itQueue != CurSeg.queueBlocks.Map.end()) /* Use existing queue. */
     510        WebMBlockMap::iterator itQueue = m_CurSeg.m_queueBlocks.Map.find(tcAbsPTS);
     511        if (itQueue != m_CurSeg.m_queueBlocks.Map.end()) /* Use existing queue. */
    512512        {
    513513            WebMTimecodeBlocks &Blocks = itQueue->second;
     
    519519            Blocks.Enqueue(a_pBlock);
    520520
    521             CurSeg.queueBlocks.Map[tcAbsPTS] = Blocks;
     521            m_CurSeg.m_queueBlocks.Map[tcAbsPTS] = Blocks;
    522522        }
    523523
    524         vrc = processQueue(&CurSeg.queueBlocks, false /* fForce */);
     524        vrc = processQueue(&m_CurSeg.m_queueBlocks, false /* fForce */);
    525525    }
    526526    catch(...)
     
    547547int WebMWriter::WriteBlock(uint8_t uTrack, const void *pvData, size_t cbData, WebMTimecodeAbs tcAbsPTSMs, WebMBlockFlags uFlags)
    548548{
    549     int vrc = RTCritSectEnter(&CurSeg.CritSect);
     549    int vrc = RTCritSectEnter(&m_CurSeg.m_CritSect);
    550550    AssertRC(vrc);
    551551
    552     WebMTracks::iterator itTrack = CurSeg.mapTracks.find(uTrack);
    553     if (itTrack == CurSeg.mapTracks.end())
    554     {
    555         RTCritSectLeave(&CurSeg.CritSect);
     552    WebMTracks::iterator itTrack = m_CurSeg.m_mapTracks.find(uTrack);
     553    if (itTrack == m_CurSeg.m_mapTracks.end())
     554    {
     555        RTCritSectLeave(&m_CurSeg.m_CritSect);
    556556        return VERR_NOT_FOUND;
    557557    }
     
    577577    }
    578578
    579     int vrc2 = RTCritSectLeave(&CurSeg.CritSect);
     579    int vrc2 = RTCritSectLeave(&m_CurSeg.m_CritSect);
    580580    AssertRC(vrc2);
    581581
     
    603603    }
    604604
    605     WebMCluster &Cluster = CurSeg.CurCluster;
     605    WebMCluster &Cluster = m_CurSeg.m_CurCluster;
    606606
    607607    /* Iterate through the block map. */
    608608    WebMBlockMap::iterator it = pQueue->Map.begin();
    609     while (it != CurSeg.queueBlocks.Map.end())
     609    while (it != m_CurSeg.m_queueBlocks.Map.end())
    610610    {
    611611        WebMTimecodeAbs    mapAbsPTSMs = it->first;
     
    617617        /* If the current segment does not have any clusters (yet),
    618618         * take the first absolute PTS as the starting point for that segment. */
    619         if (CurSeg.cClusters == 0)
     619        if (m_CurSeg.m_cClusters == 0)
    620620        {
    621             CurSeg.tcAbsStartMs = mapAbsPTSMs;
     621            m_CurSeg.m_tcAbsStartMs = mapAbsPTSMs;
    622622            fClusterStart = true;
    623623        }
     
    656656            }
    657657            else /* First cluster ever? Use the segment's starting timecode. */
    658                 tcAbsClusterLastWrittenMs = CurSeg.tcAbsStartMs;
     658                tcAbsClusterLastWrittenMs = m_CurSeg.m_tcAbsStartMs;
    659659
    660660            Cluster.fOpen              = true;
    661             Cluster.uID                = CurSeg.cClusters;
     661            Cluster.uID                = m_CurSeg.m_cClusters;
    662662            /* Use the block map's currently processed TC as the cluster's starting TC. */
    663663            Cluster.tcAbsStartMs       = mapAbsPTSMs;
     
    676676            WebMCuePoint *pCuePoint = new WebMCuePoint(Cluster.tcAbsStartMs);
    677677
    678             WebMTracks::iterator itTrack = CurSeg.mapTracks.begin();
    679             while (itTrack != CurSeg.mapTracks.end())
     678            WebMTracks::iterator itTrack = m_CurSeg.m_mapTracks.begin();
     679            while (itTrack != m_CurSeg.m_mapTracks.end())
    680680            {
    681681                pCuePoint->Pos[itTrack->first] = new WebMCueTrackPosEntry(Cluster.offStart);
     
    683683            }
    684684
    685             CurSeg.lstCuePoints.push_back(pCuePoint);
     685            m_CurSeg.m_lstCuePoints.push_back(pCuePoint);
    686686
    687687            subStart(MkvElem_Cluster)
    688                 .serializeUnsignedInteger(MkvElem_Timecode, Cluster.tcAbsStartMs - CurSeg.tcAbsStartMs);
    689 
    690             CurSeg.cClusters++;
     688                .serializeUnsignedInteger(MkvElem_Timecode, Cluster.tcAbsStartMs - m_CurSeg.m_tcAbsStartMs);
     689
     690            m_CurSeg.m_cClusters++;
    691691
    692692            mapBlocks.fClusterStarted = true;
     
    694694
    695695        Log2Func(("[C%RU64] SegTcAbsStartMs=%RU64, ClusterTcAbsStartMs=%RU64, ClusterTcAbsLastWrittenMs=%RU64, mapAbsPTSMs=%RU64\n",
    696                    Cluster.uID, CurSeg.tcAbsStartMs, Cluster.tcAbsStartMs, Cluster.tcAbsLastWrittenMs, mapAbsPTSMs));
     696                   Cluster.uID, m_CurSeg.m_tcAbsStartMs, Cluster.tcAbsStartMs, Cluster.tcAbsLastWrittenMs, mapAbsPTSMs));
    697697
    698698        /* Iterate through all blocks related to the current timecode. */
     
    718718            pTrack->tcAbsLastWrittenMs = Cluster.tcAbsLastWrittenMs;
    719719
    720             if (CurSeg.tcAbsLastWrittenMs < pTrack->tcAbsLastWrittenMs)
    721                 CurSeg.tcAbsLastWrittenMs = pTrack->tcAbsLastWrittenMs;
     720            if (m_CurSeg.m_tcAbsLastWrittenMs < pTrack->tcAbsLastWrittenMs)
     721                m_CurSeg.m_tcAbsLastWrittenMs = pTrack->tcAbsLastWrittenMs;
    722722
    723723            /* Save a cue point if this is a keyframe (if no new cluster has been started,
     
    729729                WebMCuePoint *pCuePoint = new WebMCuePoint(Cluster.tcAbsLastWrittenMs);
    730730
    731                 WebMTracks::iterator itTrack = CurSeg.mapTracks.begin();
    732                 while (itTrack != CurSeg.mapTracks.end())
     731                WebMTracks::iterator itTrack = m_CurSeg.m_mapTracks.begin();
     732                while (itTrack != m_CurSeg.m_mapTracks.end())
    733733                {
    734734                    pCuePoint->Pos[itTrack->first] = new WebMCueTrackPosEntry(Cluster.offStart);
     
    736736                }
    737737
    738                 CurSeg.lstCuePoints.push_back(pCuePoint);
     738                m_CurSeg.m_lstCuePoints.push_back(pCuePoint);
    739739            }
    740740
     
    747747        Assert(mapBlocks.Queue.empty());
    748748
    749         CurSeg.queueBlocks.Map.erase(it);
    750 
    751         it = CurSeg.queueBlocks.Map.begin();
    752     }
    753 
    754     Assert(CurSeg.queueBlocks.Map.empty());
     749        m_CurSeg.m_queueBlocks.Map.erase(it);
     750
     751        it = m_CurSeg.m_queueBlocks.Map.begin();
     752    }
     753
     754    Assert(m_CurSeg.m_queueBlocks.Map.empty());
    755755
    756756    pQueue->tsLastProcessedMs = RTTimeMilliTS();
     
    774774    }
    775775
    776     if (CurSeg.CurCluster.fOpen)
     776    if (m_CurSeg.m_CurCluster.fOpen)
    777777    {
    778778        subEnd(MkvElem_Cluster);
    779         CurSeg.CurCluster.fOpen = false;
     779        m_CurSeg.m_CurCluster.fOpen = false;
    780780    }
    781781
     
    783783     * Write Cues element.
    784784     */
    785     CurSeg.offCues = RTFileTell(getFile());
    786     LogFunc(("Cues @ %RU64\n", CurSeg.offCues));
     785    m_CurSeg.m_offCues = RTFileTell(getFile());
     786    LogFunc(("Cues @ %RU64\n", m_CurSeg.m_offCues));
    787787
    788788    subStart(MkvElem_Cues);
    789789
    790     WebMCuePointList::iterator itCuePoint = CurSeg.lstCuePoints.begin();
    791     while (itCuePoint != CurSeg.lstCuePoints.end())
     790    WebMCuePointList::iterator itCuePoint = m_CurSeg.m_lstCuePoints.begin();
     791    while (itCuePoint != m_CurSeg.m_lstCuePoints.end())
    792792    {
    793793        WebMCuePoint *pCuePoint = (*itCuePoint);
     
    811811                subStart(MkvElem_CueTrackPositions)
    812812                    .serializeUnsignedInteger(MkvElem_CueTrack,           itTrackPos->first)
    813                     .serializeUnsignedInteger(MkvElem_CueClusterPosition, pTrackPos->offCluster - CurSeg.offStart, 8)
     813                    .serializeUnsignedInteger(MkvElem_CueClusterPosition, pTrackPos->offCluster - m_CurSeg.m_offStart, 8)
    814814                    .subEnd(MkvElem_CueTrackPositions);
    815815
     
    839839void WebMWriter::writeSeekHeader(void)
    840840{
    841     if (CurSeg.offSeekInfo)
    842         RTFileSeek(getFile(), CurSeg.offSeekInfo, RTFILE_SEEK_BEGIN, NULL);
     841    if (m_CurSeg.m_offSeekInfo)
     842        RTFileSeek(getFile(), m_CurSeg.m_offSeekInfo, RTFILE_SEEK_BEGIN, NULL);
    843843    else
    844         CurSeg.offSeekInfo = RTFileTell(getFile());
    845 
    846     LogFunc(("Seek Header @ %RU64\n", CurSeg.offSeekInfo));
     844        m_CurSeg.m_offSeekInfo = RTFileTell(getFile());
     845
     846    LogFunc(("Seek Header @ %RU64\n", m_CurSeg.m_offSeekInfo));
    847847
    848848    subStart(MkvElem_SeekHead);
     
    850850    subStart(MkvElem_Seek)
    851851          .serializeUnsignedInteger(MkvElem_SeekID, MkvElem_Tracks)
    852           .serializeUnsignedInteger(MkvElem_SeekPosition, CurSeg.offTracks - CurSeg.offStart, 8)
     852          .serializeUnsignedInteger(MkvElem_SeekPosition, m_CurSeg.m_offTracks - m_CurSeg.m_offStart, 8)
    853853          .subEnd(MkvElem_Seek);
    854854
    855     if (CurSeg.offCues)
    856         LogFunc(("Updating Cues @ %RU64\n", CurSeg.offCues));
     855    if (m_CurSeg.m_offCues)
     856        LogFunc(("Updating Cues @ %RU64\n", m_CurSeg.m_offCues));
    857857
    858858    subStart(MkvElem_Seek)
    859859          .serializeUnsignedInteger(MkvElem_SeekID, MkvElem_Cues)
    860           .serializeUnsignedInteger(MkvElem_SeekPosition, CurSeg.offCues - CurSeg.offStart, 8)
     860          .serializeUnsignedInteger(MkvElem_SeekPosition, m_CurSeg.m_offCues - m_CurSeg.m_offStart, 8)
    861861          .subEnd(MkvElem_Seek);
    862862
    863863    subStart(MkvElem_Seek)
    864864          .serializeUnsignedInteger(MkvElem_SeekID, MkvElem_Info)
    865           .serializeUnsignedInteger(MkvElem_SeekPosition, CurSeg.offInfo - CurSeg.offStart, 8)
     865          .serializeUnsignedInteger(MkvElem_SeekPosition, m_CurSeg.m_offInfo - m_CurSeg.m_offStart, 8)
    866866          .subEnd(MkvElem_Seek);
    867867
     
    873873
    874874    /* Save offset of the segment's info element. */
    875     CurSeg.offInfo = RTFileTell(getFile());
    876 
    877     LogFunc(("Info @ %RU64\n", CurSeg.offInfo));
     875    m_CurSeg.m_offInfo = RTFileTell(getFile());
     876
     877    LogFunc(("Info @ %RU64\n", m_CurSeg.m_offInfo));
    878878
    879879    char szMux[64];
     
    888888    RTStrPrintf(szApp, sizeof(szApp), VBOX_PRODUCT " %sr%u", VBOX_VERSION_STRING, RTBldCfgRevision());
    889889
    890     const WebMTimecodeAbs tcAbsDurationMs = CurSeg.tcAbsLastWrittenMs - CurSeg.tcAbsStartMs;
    891 
    892     if (!CurSeg.lstCuePoints.empty())
     890    const WebMTimecodeAbs tcAbsDurationMs = m_CurSeg.m_tcAbsLastWrittenMs - m_CurSeg.m_tcAbsStartMs;
     891
     892    if (!m_CurSeg.m_lstCuePoints.empty())
    893893    {
    894894        LogFunc(("tcAbsDurationMs=%RU64\n", tcAbsDurationMs));
     
    897897
    898898    subStart(MkvElem_Info)
    899         .serializeUnsignedInteger(MkvElem_TimecodeScale, CurSeg.uTimecodeScaleFactor)
     899        .serializeUnsignedInteger(MkvElem_TimecodeScale, m_CurSeg.m_uTimecodeScaleFactor)
    900900        .serializeFloat(MkvElem_Segment_Duration, tcAbsDurationMs)
    901901        .serializeString(MkvElem_MuxingApp, szMux)
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