You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After finding various references about mapping the flexible pixel format to NV12, I tried this patch, which seems to solve the problem on my Baytrail platform, there's no crash and the WebView is able to access/display the webcam stream:
diff --git a/gralloc_gbm.cpp b/gralloc_gbm.cpp
index 5670213..75043dd 100644
--- a/gralloc_gbm.cpp
+++ b/gralloc_gbm.cpp
@@ -98,6 +98,7 @@ static uint32_t get_gbm_format(int format)
break;
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_420_888:
default:
fmt = 0;
break;
@@ -127,6 +128,7 @@ static int gralloc_gbm_get_bpp(int format)
case HAL_PIXEL_FORMAT_YV12:
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_420_888:
bpp = 1;
break;
default:
@@ -507,6 +509,7 @@ int gralloc_gbm_bo_lock_ycbcr(buffer_handle_t handle,
switch (hnd->format) {
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_420_888:
ystride = cstride = GRALLOC_ALIGN(hnd->width, 16);
ycbcr->y = addr;
ycbcr->cr = (unsigned char *)addr + ystride * hnd->height;
On Android R (android-11.0.0_r35) with mesa-21.1.0, gbm_gralloc and drm_hwcomposer, opening the webcam in a WebView (Chrome/89) crashes the app at this line: https://github.com/robherring/gbm_gralloc/blob/master/gralloc_gbm.cpp#L386
The format requested is
HAL_PIXEL_FORMAT_YCbCr_420_888
(35), which is not supported bygralloc_gbm_get_bpp
. It returns 0 and leads to SIGFPE.The text was updated successfully, but these errors were encountered: