Changeset 76893 in vbox
- Timestamp:
- Jan 18, 2019 1:51:30 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128261
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/Recording.h
r76760 r76893 35 35 36 36 /** 37 * Class for managing a capturing context.37 * Class for managing a recording context. 38 38 */ 39 39 class RecordingContext … … 52 52 53 53 int Create(const settings::RecordingSettings &a_Settings); 54 intDestroy(void);54 void Destroy(void); 55 55 56 56 int Start(void); … … 65 65 66 66 bool IsFeatureEnabled(RecordingFeature_T enmFeature); 67 bool IsReady(void) const;67 bool IsReady(void); 68 68 bool IsReady(uint32_t uScreen, uint64_t msTimestamp); 69 69 bool IsStarted(void); … … 79 79 int stopInternal(void); 80 80 81 intdestroyInternal(void);81 void destroyInternal(void); 82 82 83 83 RecordingStream *getStreamInternal(unsigned uScreen) const; -
trunk/src/VBox/Main/src-client/Recording.cpp
r76553 r76893 217 217 218 218 if (RT_FAILURE(rc)) 219 { 220 int rc2 = destroyInternal(); 221 AssertRC(rc2); 222 } 219 destroyInternal(); 223 220 224 221 return rc; … … 274 271 rc = RTThreadWait(this->Thread, 30 * 1000 /* 10s timeout */, NULL); 275 272 273 lock(); 274 276 275 if (RT_SUCCESS(rc)) 277 276 { … … 282 281 Log(("Recording: Failed to stop (%Rrc)\n", rc)); 283 282 283 unlock(); 284 284 285 LogFlowThisFunc(("%Rrc\n", rc)); 285 286 return rc; … … 289 290 * Destroys a recording context, internal version. 290 291 */ 291 int RecordingContext::destroyInternal(void) 292 { 292 void RecordingContext::destroyInternal(void) 293 { 294 if (this->enmState == RECORDINGSTS_UNINITIALIZED) 295 return; 296 293 297 int rc = stopInternal(); 294 if (RT_FAILURE(rc)) 295 return rc; 298 AssertRCReturnVoid(rc); 299 300 lock(); 296 301 297 302 rc = RTSemEventDestroy(this->WaitEvent); 298 AssertRC (rc);303 AssertRCReturnVoid(rc); 299 304 300 305 this->WaitEvent = NIL_RTSEMEVENT; 301 306 302 rc = RTCritSectEnter(&this->CritSect); 303 if (RT_SUCCESS(rc)) 304 { 305 RecordingStreams::iterator it = this->vecStreams.begin(); 306 while (it != this->vecStreams.end()) 307 { 308 RecordingStream *pStream = (*it); 309 310 int rc2 = pStream->Uninit(); 311 if (RT_SUCCESS(rc)) 312 rc = rc2; 313 314 delete pStream; 315 pStream = NULL; 316 317 this->vecStreams.erase(it); 318 it = this->vecStreams.begin(); 319 320 delete pStream; 321 pStream = NULL; 322 } 323 324 /* Sanity. */ 325 Assert(this->vecStreams.empty()); 326 Assert(this->mapBlocksCommon.size() == 0); 327 328 int rc2 = RTCritSectLeave(&this->CritSect); 329 AssertRC(rc2); 330 307 RecordingStreams::iterator it = this->vecStreams.begin(); 308 while (it != this->vecStreams.end()) 309 { 310 RecordingStream *pStream = (*it); 311 312 rc = pStream->Uninit(); 313 AssertRC(rc); 314 315 delete pStream; 316 pStream = NULL; 317 318 this->vecStreams.erase(it); 319 it = this->vecStreams.begin(); 320 } 321 322 /* Sanity. */ 323 Assert(this->vecStreams.empty()); 324 Assert(this->mapBlocksCommon.size() == 0); 325 326 unlock(); 327 328 if (RTCritSectIsInitialized(&this->CritSect)) 329 { 330 Assert(RTCritSectGetWaiters(&this->CritSect) == -1); 331 331 RTCritSectDelete(&this->CritSect); 332 332 } 333 333 334 LogFlowThisFunc(("%Rrc\n", rc)); 335 return rc; 334 this->enmState = RECORDINGSTS_UNINITIALIZED; 336 335 } 337 336 … … 418 417 * Destroys a recording context. 419 418 */ 420 intRecordingContext::Destroy(void)421 { 422 returndestroyInternal();419 void RecordingContext::Destroy(void) 420 { 421 destroyInternal(); 423 422 } 424 423 … … 474 473 * @returns @c true if recording context is ready, @c false if not. 475 474 */ 476 bool RecordingContext::IsReady(void) const 477 { 478 return (this->enmState >= RECORDINGSTS_CREATED); 475 bool RecordingContext::IsReady(void) 476 { 477 lock(); 478 479 const bool fIsReady = this->enmState >= RECORDINGSTS_CREATED; 480 481 unlock(); 482 483 return fIsReady; 479 484 } 480 485 … … 624 629 pBlock->msTimestamp = msTimestamp; 625 630 626 int rc = RTCritSectEnter(&this->CritSect);627 if (RT_FAILURE(rc)) 628 returnrc;631 lock(); 632 633 int rc; 629 634 630 635 try … … 640 645 else 641 646 itBlocks->second->List.push_back(pBlock); 647 648 rc = VINF_SUCCESS; 642 649 } 643 650 catch (const std::exception &ex) … … 647 654 } 648 655 649 int rc2 = RTCritSectLeave(&this->CritSect); 650 AssertRC(rc2); 656 unlock(); 651 657 652 658 if (RT_SUCCESS(rc)) … … 687 693 AssertReturn(puSrcData, VERR_INVALID_POINTER); 688 694 689 int rc = RTCritSectEnter(&this->CritSect); 690 AssertRC(rc); 695 lock(); 691 696 692 697 RecordingStream *pStream = GetStream(uScreen); 693 698 if (!pStream) 694 699 { 695 rc = RTCritSectLeave(&this->CritSect); 696 AssertRC(rc); 700 unlock(); 697 701 698 702 AssertFailed(); … … 700 704 } 701 705 702 rc = pStream->SendVideoFrame(x, y, uPixelFormat, uBPP, uBytesPerLine, uSrcWidth, uSrcHeight, puSrcData, msTimestamp); 703 704 int rc2 = RTCritSectLeave(&this->CritSect); 705 AssertRC(rc2); 706 int rc = pStream->SendVideoFrame(x, y, uPixelFormat, uBPP, uBytesPerLine, uSrcWidth, uSrcHeight, puSrcData, msTimestamp); 707 708 unlock(); 706 709 707 710 if ( RT_SUCCESS(rc)
Note:
See TracChangeset
for help on using the changeset viewer.