Changeset 94950 in vbox
- Timestamp:
- May 9, 2022 11:49:03 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 151358
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/Recording.cpp
r93115 r94950 63 63 , cStreamsEnabled(0) 64 64 { 65 int rc = RecordingContext::createInternal(a_Settings);66 if (RT_FAILURE( rc))67 throw rc;65 int vrc = RecordingContext::createInternal(a_Settings); 66 if (RT_FAILURE(vrc)) 67 throw vrc; 68 68 } 69 69 … … 89 89 for (;;) 90 90 { 91 int rc = RTSemEventWait(pThis->WaitEvent, RT_INDEFINITE_WAIT);92 AssertRCBreak( rc);91 int vrc = RTSemEventWait(pThis->WaitEvent, RT_INDEFINITE_WAIT); 92 AssertRCBreak(vrc); 93 93 94 94 Log2Func(("Processing %zu streams\n", pThis->vecStreams.size())); … … 102 102 RecordingStream *pStream = (*itStream); 103 103 104 rc = pStream->Process(pThis->mapBlocksCommon);105 if (RT_FAILURE( rc))104 vrc = pStream->Process(pThis->mapBlocksCommon); 105 if (RT_FAILURE(vrc)) 106 106 { 107 LogRel(("Recording: Processing stream #%RU16 failed (%Rrc)\n", pStream->GetID(), rc));107 LogRel(("Recording: Processing stream #%RU16 failed (%Rrc)\n", pStream->GetID(), vrc)); 108 108 break; 109 109 } … … 112 112 } 113 113 114 if (RT_FAILURE( rc))115 LogRel(("Recording: Encoding thread failed (%Rrc)\n", rc));114 if (RT_FAILURE(vrc)) 115 LogRel(("Recording: Encoding thread failed (%Rrc)\n", vrc)); 116 116 117 117 /* Keep going in case of errors. */ … … 147 147 int RecordingContext::createInternal(const settings::RecordingSettings &a_Settings) 148 148 { 149 int rc = RTCritSectInit(&this->CritSect);150 if (RT_FAILURE( rc))151 return rc;149 int vrc = RTCritSectInit(&this->CritSect); 150 if (RT_FAILURE(vrc)) 151 return vrc; 152 152 153 153 settings::RecordingScreenMap::const_iterator itScreen = a_Settings.mapScreens.begin(); … … 164 164 catch (std::bad_alloc &) 165 165 { 166 rc = VERR_NO_MEMORY;166 vrc = VERR_NO_MEMORY; 167 167 break; 168 168 } … … 171 171 } 172 172 173 if (RT_SUCCESS( rc))173 if (RT_SUCCESS(vrc)) 174 174 { 175 175 this->tsStartMs = RTTimeMilliTS(); … … 180 180 this->Settings = a_Settings; 181 181 182 rc = RTSemEventCreate(&this->WaitEvent);183 AssertRCReturn( rc,rc);184 } 185 186 if (RT_FAILURE( rc))182 vrc = RTSemEventCreate(&this->WaitEvent); 183 AssertRCReturn(vrc, vrc); 184 } 185 186 if (RT_FAILURE(vrc)) 187 187 destroyInternal(); 188 188 189 return rc;189 return vrc; 190 190 } 191 191 … … 202 202 Assert(this->enmState == RECORDINGSTS_CREATED); 203 203 204 int rc = RTThreadCreate(&this->Thread, RecordingContext::threadMain, (void *)this, 0,205 RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, "Record");206 207 if (RT_SUCCESS( rc)) /* Wait for the thread to start. */208 rc = RTThreadUserWait(this->Thread, 30 * RT_MS_1SEC /* 30s timeout */);209 210 if (RT_SUCCESS( rc))204 int vrc = RTThreadCreate(&this->Thread, RecordingContext::threadMain, (void *)this, 0, 205 RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, "Record"); 206 207 if (RT_SUCCESS(vrc)) /* Wait for the thread to start. */ 208 vrc = RTThreadUserWait(this->Thread, 30 * RT_MS_1SEC /* 30s timeout */); 209 210 if (RT_SUCCESS(vrc)) 211 211 { 212 212 LogRel(("Recording: Started\n")); … … 214 214 } 215 215 else 216 Log(("Recording: Failed to start (%Rrc)\n", rc));217 218 return rc;216 Log(("Recording: Failed to start (%Rrc)\n", vrc)); 217 218 return vrc; 219 219 } 220 220 … … 235 235 236 236 /* Signal the thread and wait for it to shut down. */ 237 int rc = threadNotify();238 if (RT_SUCCESS( rc))239 rc = RTThreadWait(this->Thread, 30 * 1000 /* 10s timeout */, NULL);240 241 lock(); 242 243 if (RT_SUCCESS( rc))237 int vrc = threadNotify(); 238 if (RT_SUCCESS(vrc)) 239 vrc = RTThreadWait(this->Thread, 30 * 1000 /* 10s timeout */, NULL); 240 241 lock(); 242 243 if (RT_SUCCESS(vrc)) 244 244 { 245 245 LogRel(("Recording: Stopped\n")); … … 247 247 } 248 248 else 249 Log(("Recording: Failed to stop (%Rrc)\n", rc));250 251 unlock(); 252 253 LogFlowThisFunc(("%Rrc\n", rc));254 return rc;249 Log(("Recording: Failed to stop (%Rrc)\n", vrc)); 250 251 unlock(); 252 253 LogFlowThisFunc(("%Rrc\n", vrc)); 254 return vrc; 255 255 } 256 256 … … 263 263 return; 264 264 265 int rc = stopInternal();266 AssertRCReturnVoid( rc);267 268 lock(); 269 270 rc = RTSemEventDestroy(this->WaitEvent);271 AssertRCReturnVoid( rc);265 int vrc = stopInternal(); 266 AssertRCReturnVoid(vrc); 267 268 lock(); 269 270 vrc = RTSemEventDestroy(this->WaitEvent); 271 AssertRCReturnVoid(vrc); 272 272 273 273 this->WaitEvent = NIL_RTSEMEVENT; … … 278 278 RecordingStream *pStream = (*it); 279 279 280 rc = pStream->Uninit();281 AssertRC( rc);280 vrc = pStream->Uninit(); 281 AssertRC(vrc); 282 282 283 283 delete pStream; … … 337 337 int RecordingContext::lock(void) 338 338 { 339 int rc = RTCritSectEnter(&this->CritSect);340 AssertRC( rc);341 return rc;339 int vrc = RTCritSectEnter(&this->CritSect); 340 AssertRC(vrc); 341 return vrc; 342 342 } 343 343 344 344 int RecordingContext::unlock(void) 345 345 { 346 int rc = RTCritSectLeave(&this->CritSect);347 AssertRC( rc);348 return rc;346 int vrc = RTCritSectLeave(&this->CritSect); 347 AssertRC(vrc); 348 return vrc; 349 349 } 350 350 … … 599 599 lock(); 600 600 601 int rc;601 int vrc; 602 602 603 603 try … … 614 614 itBlocks->second->List.push_back(pBlock); 615 615 616 rc = VINF_SUCCESS;616 vrc = VINF_SUCCESS; 617 617 } 618 618 catch (const std::exception &ex) 619 619 { 620 620 RT_NOREF(ex); 621 rc = VERR_NO_MEMORY;622 } 623 624 unlock(); 625 626 if (RT_SUCCESS( rc))627 rc = threadNotify();628 629 return rc;621 vrc = VERR_NO_MEMORY; 622 } 623 624 unlock(); 625 626 if (RT_SUCCESS(vrc)) 627 vrc = threadNotify(); 628 629 return vrc; 630 630 #else 631 631 RT_NOREF(pvData, cbData, msTimestamp); … … 672 672 } 673 673 674 int rc = pStream->SendVideoFrame(x, y, uPixelFormat, uBPP, uBytesPerLine, uSrcWidth, uSrcHeight, puSrcData, msTimestamp);675 676 unlock(); 677 678 if ( RT_SUCCESS( rc)679 && rc != VINF_RECORDING_THROTTLED) /* Only signal the thread if operation was successful. */674 int vrc = pStream->SendVideoFrame(x, y, uPixelFormat, uBPP, uBytesPerLine, uSrcWidth, uSrcHeight, puSrcData, msTimestamp); 675 676 unlock(); 677 678 if ( RT_SUCCESS(vrc) 679 && vrc != VINF_RECORDING_THROTTLED) /* Only signal the thread if operation was successful. */ 680 680 { 681 681 threadNotify(); 682 682 } 683 683 684 return rc;685 } 686 684 return vrc; 685 } 686
Note:
See TracChangeset
for help on using the changeset viewer.