video/out/android: assert WinID value before use

This commit is contained in:
sfan5 2023-06-03 17:06:36 +02:00
parent c1bef0f084
commit e18cf0b92a
2 changed files with 2 additions and 0 deletions

View File

@ -44,6 +44,7 @@ bool vo_android_init(struct vo *vo)
goto fail;
}
assert(vo->opts->WinID != 0 && vo->opts->WinID != -1);
jobject surface = (jobject)(intptr_t)vo->opts->WinID;
ctx->native_window = ANativeWindow_fromSurface(env, surface);
if (!ctx->native_window) {

View File

@ -37,6 +37,7 @@ static AVBufferRef *create_mediacodec_device_ref(struct vo *vo)
AVHWDeviceContext *ctx = (void *)device_ref->data;
AVMediaCodecDeviceContext *hwctx = ctx->hwctx;
assert(vo->opts->WinID != 0 && vo->opts->WinID != -1);
hwctx->surface = (void *)(intptr_t)(vo->opts->WinID);
if (av_hwdevice_ctx_init(device_ref) < 0)