Merge "Guard against native crash due to null Surface" into pi-dev

This commit is contained in:
Marco Nelissen
2018-04-23 19:58:46 +00:00
committed by Android (Google) Code Review

View File

@@ -1261,6 +1261,11 @@ static void android_media_MediaCodec_setInputSurface(
sp<PersistentSurface> persistentSurface =
android_media_MediaCodec_getPersistentInputSurface(env, object);
if (persistentSurface == NULL) {
throwExceptionAsNecessary(
env, BAD_VALUE, ACTION_CODE_FATAL, "input surface not valid");
return;
}
status_t err = codec->setInputSurface(persistentSurface);
if (err != NO_ERROR) {
throwExceptionAsNecessary(env, err);