Skip to content

Commit

Permalink
SurfaceUtils: ensure lock() grants a valid pointer
Browse files Browse the repository at this point in the history
Sometimes lock() of GraphicBuffer does not grants a valid mapping
pointer though the return value is NO_ERROR. Regards this case as an
error.

Bug: 303816969
Change-Id: I95d2a583dd8fdd117534f349d9f9e71323792bd7
Signed-off-by: Hưng Phan <[email protected]>
  • Loading branch information
Sungtak Lee authored and hungphan2001 committed Dec 17, 2023
1 parent 268c4a8 commit b07f6e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions media/libstagefright/SurfaceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@ status_t pushBlankBuffersToNativeWindow(ANativeWindow *nativeWindow /* nonnull *
ALOGE("error pushing blank frames: lock failed: %s (%d)", strerror(-err), -err);
break;
}
if (img == nullptr) {
(void)buf->unlock(); // Since lock() was successful.
ALOGE("error pushing blank frames: lock succeeded: buf mapping is nullptr");
break;
}

*img = 0;

Expand Down

0 comments on commit b07f6e5

Please sign in to comment.