mirror of https://github.com/mpv-player/mpv
video/out/android: assert WinID value before use
This commit is contained in:
parent
c1bef0f084
commit
e18cf0b92a
|
@ -44,6 +44,7 @@ bool vo_android_init(struct vo *vo)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(vo->opts->WinID != 0 && vo->opts->WinID != -1);
|
||||||
jobject surface = (jobject)(intptr_t)vo->opts->WinID;
|
jobject surface = (jobject)(intptr_t)vo->opts->WinID;
|
||||||
ctx->native_window = ANativeWindow_fromSurface(env, surface);
|
ctx->native_window = ANativeWindow_fromSurface(env, surface);
|
||||||
if (!ctx->native_window) {
|
if (!ctx->native_window) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ static AVBufferRef *create_mediacodec_device_ref(struct vo *vo)
|
||||||
|
|
||||||
AVHWDeviceContext *ctx = (void *)device_ref->data;
|
AVHWDeviceContext *ctx = (void *)device_ref->data;
|
||||||
AVMediaCodecDeviceContext *hwctx = ctx->hwctx;
|
AVMediaCodecDeviceContext *hwctx = ctx->hwctx;
|
||||||
|
assert(vo->opts->WinID != 0 && vo->opts->WinID != -1);
|
||||||
hwctx->surface = (void *)(intptr_t)(vo->opts->WinID);
|
hwctx->surface = (void *)(intptr_t)(vo->opts->WinID);
|
||||||
|
|
||||||
if (av_hwdevice_ctx_init(device_ref) < 0)
|
if (av_hwdevice_ctx_init(device_ref) < 0)
|
||||||
|
|
Loading…
Reference in New Issue