- Timestamp:
- Jul 8, 2016 1:32:43 PM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/DisplayImpl.h
r61564 r62139 95 95 } pendingViewportInfo; 96 96 #endif /* VBOX_WITH_CROGL */ 97 98 #ifdef VBOX_WITH_VPX 99 struct 100 { 101 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 102 } videoCapture; 103 #endif 97 104 } DISPLAYFBINFO; 98 105 … … 195 202 void i_VideoCaptureStop(); 196 203 int i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens)); 204 #ifdef VBOX_WITH_VPX 205 void videoCaptureScreenChanged(unsigned uScreenId); 206 #endif 197 207 198 208 void i_notifyPowerDown(void); … … 449 459 /* Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */ 450 460 RTCRITSECT mVideoAccelLock; 461 #ifdef VBOX_WITH_VPX 462 /* Serializes access to video capture source bitmaps. */ 463 RTCRITSECT mVideoCaptureLock; 464 #endif 451 465 452 466 public: -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r61740 r62139 132 132 #endif 133 133 #ifdef VBOX_WITH_VPX 134 rc = RTCritSectInit(&mVideoCaptureLock); 135 AssertRC(rc); 136 134 137 mpVideoRecCtx = NULL; 135 138 for (unsigned i = 0; i < RT_ELEMENTS(maVideoRecEnabled); i++) … … 159 162 { 160 163 uninit(); 164 165 #ifdef VBOX_WITH_VPX 166 if (RTCritSectIsInitialized(&mVideoCaptureLock)) 167 { 168 RTCritSectDelete(&mVideoCaptureLock); 169 RT_ZERO(mVideoCaptureLock); 170 } 171 #endif 161 172 162 173 videoAccelDestroy(&mVideoAccelLegacy); … … 703 714 maFramebuffers[uScreenId].updateImage.cbLine = 0; 704 715 maFramebuffers[uScreenId].pFramebuffer.setNull(); 716 #ifdef VBOX_WITH_VPX 717 maFramebuffers[uScreenId].videoCapture.pSourceBitmap.setNull(); 718 #endif 705 719 } 706 720 … … 961 975 if (mfSeamlessEnabled) 962 976 i_handleSetVisibleRegion(mcRectVisibleRegion, mpRectVisibleRegion); 977 978 #ifdef VBOX_WITH_VPX 979 videoCaptureScreenChanged(uScreenId); 980 #endif 963 981 964 982 LogRelFlowFunc(("[%d]: default format %d\n", uScreenId, pFBInfo->fDefaultFormat)); … … 2221 2239 com::SafeArray<BOOL> Screens(ComSafeArrayInArg(aScreens)); 2222 2240 for (unsigned i = 0; i < Screens.size(); i++) 2241 { 2242 bool fChanged = maVideoRecEnabled[i] != RT_BOOL(Screens[i]); 2243 2223 2244 maVideoRecEnabled[i] = RT_BOOL(Screens[i]); 2245 2246 if (fChanged && i < mcMonitors) 2247 videoCaptureScreenChanged(i); 2248 2249 } 2224 2250 return VINF_SUCCESS; 2225 2251 #else … … 2330 2356 LogRel(("Display::VideoCaptureStart: WebM/VP8 video recording screen #%u with %ux%u @ %u kbps, %u fps to '%s' " 2331 2357 "enabled\n", uScreen, ulWidth, ulHeight, ulRate, ulFPS, pszName)); 2358 2359 videoCaptureScreenChanged(uScreen); 2332 2360 } 2333 2361 else … … 2353 2381 VideoRecContextClose(mpVideoRecCtx); 2354 2382 mpVideoRecCtx = NULL; 2355 #endif 2356 } 2383 2384 unsigned uScreenId; 2385 for (uScreenId = 0; uScreenId < mcMonitors; ++uScreenId) 2386 videoCaptureScreenChanged(uScreenId); 2387 #endif 2388 } 2389 2390 #ifdef VBOX_WITH_VPX 2391 void Display::videoCaptureScreenChanged(unsigned uScreenId) 2392 { 2393 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 2394 2395 if (VideoRecIsEnabled(mpVideoRecCtx) && maVideoRecEnabled[uScreenId]) 2396 { 2397 /* Get a new source bitmap which will be used by video capture code. */ 2398 QuerySourceBitmap(uScreenId, pSourceBitmap.asOutParam()); 2399 } 2400 2401 int rc = RTCritSectEnter(&mVideoCaptureLock); 2402 if (RT_SUCCESS(rc)) 2403 { 2404 maFramebuffers[uScreenId].videoCapture.pSourceBitmap = pSourceBitmap; 2405 RTCritSectLeave(&mVideoCaptureLock); 2406 } 2407 } 2408 #endif 2357 2409 2358 2410 int Display::i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, … … 3107 3159 3108 3160 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId]; 3109 3110 if ( !pFBInfo->pFramebuffer.isNull() 3111 && !pFBInfo->fDisabled) 3161 if (!pFBInfo->fDisabled) 3112 3162 { 3113 rc = VERR_NOT_SUPPORTED;3114 i f ( pFBInfo->fVBVAEnabled3115 && pFBInfo->pu8FramebufferVRAM)3163 ComPtr<IDisplaySourceBitmap> pSourceBitmap; 3164 int rc2 = RTCritSectEnter(&pDisplay->mVideoCaptureLock); 3165 if (RT_SUCCESS(rc2)) 3116 3166 { 3117 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, 3118 BitmapFormat_BGR, 3119 pFBInfo->u16BitsPerPixel, 3120 pFBInfo->u32LineSize, pFBInfo->w, pFBInfo->h, 3121 pFBInfo->pu8FramebufferVRAM, u64Now); 3167 pSourceBitmap = pFBInfo->videoCapture.pSourceBitmap; 3168 RTCritSectLeave(&pDisplay->mVideoCaptureLock); 3122 3169 } 3123 else if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && pDrv->IConnector.pbData) 3170 3171 if (!pSourceBitmap.isNull()) 3124 3172 { 3125 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, 3126 BitmapFormat_BGR, 3127 pDrv->IConnector.cBits, 3128 pDrv->IConnector.cbScanline, pDrv->IConnector.cx, 3129 pDrv->IConnector.cy, pDrv->IConnector.pbData, u64Now); 3173 BYTE *pbAddress = NULL; 3174 ULONG ulWidth = 0; 3175 ULONG ulHeight = 0; 3176 ULONG ulBitsPerPixel = 0; 3177 ULONG ulBytesPerLine = 0; 3178 BitmapFormat_T bitmapFormat = BitmapFormat_Opaque; 3179 HRESULT hr = pSourceBitmap->QueryBitmapInfo(&pbAddress, 3180 &ulWidth, 3181 &ulHeight, 3182 &ulBitsPerPixel, 3183 &ulBytesPerLine, 3184 &bitmapFormat); 3185 if (SUCCEEDED(hr) && pbAddress) 3186 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, 3187 BitmapFormat_BGR, 3188 ulBitsPerPixel, ulBytesPerLine, ulWidth, ulHeight, 3189 pbAddress, u64Now); 3190 else 3191 rc = VERR_NOT_SUPPORTED; 3192 3193 pSourceBitmap.setNull(); 3130 3194 } 3195 else 3196 rc = VERR_NOT_SUPPORTED; 3197 3131 3198 if (rc == VINF_TRY_AGAIN) 3132 3199 break;
Note:
See TracChangeset
for help on using the changeset viewer.