Changeset 96322 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 19, 2022 7:45:57 AM (2 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/Recording.h
r96260 r96322 70 70 bool IsLimitReached(void); 71 71 bool IsLimitReached(uint32_t uScreen, uint64_t msTimestamp); 72 bool NeedsUpdate( uint32_t uScreen, uint64_t msTimestamp); 72 73 73 74 DECLCALLBACK(int) OnLimitReached(uint32_t uScreen, int rc); -
trunk/src/VBox/Main/include/RecordingInternals.h
r96285 r96322 454 454 int recordingCodecEncode(PRECORDINGCODEC pCodec, const PRECORDINGFRAME pFrame, size_t *pcEncoded, size_t *pcbEncoded); 455 455 int recordingCodecFinalize(PRECORDINGCODEC pCodec); 456 uint32_t recordingCodecGetWritable(PRECORDINGCODEC pCodec, uint64_t msTimestamp); 456 bool recordingCodecIsInitialized(const PRECORDINGCODEC pCodec); 457 uint32_t recordingCodecGetWritable(const PRECORDINGCODEC pCodec, uint64_t msTimestamp); 457 458 #endif /* !MAIN_INCLUDED_RecordingInternals_h */ -
trunk/src/VBox/Main/include/RecordingStream.h
r96260 r96322 130 130 #endif 131 131 PRECORDINGCODEC GetVideoCodec(void) { return &this->CodecVideo; }; 132 132 133 bool IsLimitReached(uint64_t msTimestamp) const; 133 134 bool IsReady(void) const; 135 bool NeedsUpdate(uint64_t msTimestamp) const; 134 136 135 137 public: -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r94916 r96322 2994 2994 { 2995 2995 if (!pDisplay->maRecordingEnabled[uScreenId]) 2996 continue; 2997 2998 if (!pCtx->NeedsUpdate(uScreenId, tsNowMs)) 2996 2999 continue; 2997 3000 -
trunk/src/VBox/Main/src-client/Recording.cpp
r96284 r96322 810 810 811 811 return fLimitReached; 812 } 813 814 /** 815 * Returns if a specific screen needs to be fed with an update or not. 816 * 817 * @returns @c true if an update is needed, @c false if not. 818 * @param uScreen Screen ID to retrieve update stats for. 819 * @param msTimestamp Timestamp (PTS, in ms). 820 */ 821 bool RecordingContext::NeedsUpdate( uint32_t uScreen, uint64_t msTimestamp) 822 { 823 lock(); 824 825 bool fNeedsUpdate = false; 826 827 if (this->enmState == RECORDINGSTS_STARTED) 828 { 829 if ( recordingCodecIsInitialized(&CodecAudio) 830 && recordingCodecGetWritable(&CodecAudio, msTimestamp) > 0) 831 { 832 fNeedsUpdate = true; 833 } 834 835 if (!fNeedsUpdate) 836 { 837 const RecordingStream *pStream = getStreamInternal(uScreen); 838 if (pStream) 839 fNeedsUpdate = pStream->NeedsUpdate(msTimestamp); 840 } 841 } 842 843 unlock(); 844 845 return fNeedsUpdate; 812 846 } 813 847 -
trunk/src/VBox/Main/src-client/RecordingCodec.cpp
r96288 r96322 852 852 853 853 /** 854 * Returns whether the codec has been initialized or not. 855 * 856 * @returns \c true if initialized, or \c false if not. 857 * @param pCodec Codec to return initialization status for. 858 */ 859 bool recordingCodecIsInitialized(const PRECORDINGCODEC pCodec) 860 { 861 return pCodec->Ops.pfnInit != NULL; /* pfnInit acts as a beacon for initialization status. */ 862 } 863 864 /** 854 865 * Returns the number of writable bytes for a given timestamp. 855 866 * … … 860 871 * @param msTimestamp Timestamp (PTS, in ms) return number of writable bytes for. 861 872 */ 862 uint32_t recordingCodecGetWritable( PRECORDINGCODEC pCodec, uint64_t msTimestamp)873 uint32_t recordingCodecGetWritable(const PRECORDINGCODEC pCodec, uint64_t msTimestamp) 863 874 { 864 875 Log3Func(("%RU64 -- tsLastWrittenMs=%RU64 + uDelayMs=%RU32\n", -
trunk/src/VBox/Main/src-client/RecordingStream.cpp
r96284 r96322 283 283 284 284 /** 285 * Returns if a recording stream needs to be fed with an update or not. 286 * 287 * @returns @c true if an update is needed, @c false if not. 288 * @param msTimestamp Timestamp (PTS, in ms). 289 */ 290 bool RecordingStream::NeedsUpdate(uint64_t msTimestamp) const 291 { 292 return recordingCodecGetWritable((const PRECORDINGCODEC)&CodecVideo, msTimestamp) > 0; 293 } 294 295 /** 285 296 * Processes a recording stream. 286 297 * This function takes care of the actual encoding and writing of a certain stream. … … 432 443 { 433 444 AssertPtrReturn(m_pCtx, VERR_WRONG_ORDER); 445 AssertReturn(NeedsUpdate(msTimestamp), VINF_RECORDING_THROTTLED); /* We ASSUME that the caller checked that first. */ 434 446 435 447 Log3Func(("cbData=%zu, msTimestamp=%RU64\n", cbData, msTimestamp)); … … 459 471 uint32_t uSrcWidth, uint32_t uSrcHeight, uint8_t *puSrcData, uint64_t msTimestamp) 460 472 { 473 AssertPtrReturn(m_pCtx, VERR_WRONG_ORDER); 474 AssertReturn(NeedsUpdate(msTimestamp), VINF_RECORDING_THROTTLED); /* We ASSUME that the caller checked that first. */ 475 461 476 lock(); 462 477 463 478 Log3Func(("[%RU32 %RU32 %RU32 %RU32] msTimestamp=%RU64\n", x , y, uSrcWidth, uSrcHeight, msTimestamp)); 464 465 PRECORDINGCODEC pCodec = &this->CodecVideo;466 479 467 480 PRECORDINGVIDEOFRAME pFrame = NULL; … … 476 489 do 477 490 { 478 if (recordingCodecGetWritable(pCodec, msTimestamp) == 0)479 {480 vrc = VINF_RECORDING_THROTTLED; /* Respect maximum frames per second (FPS). */481 break;482 }483 484 491 int xDiff = ((int)this->ScreenSettings.Video.ulWidth - (int)uSrcWidth) / 2; 485 492 uint32_t w = uSrcWidth;
Note:
See TracChangeset
for help on using the changeset viewer.