summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorRajneesh Chowdury <rajneeshc@google.com>2011-03-16 16:05:54 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-16 16:05:54 -0700
commit69d05490345e96e1155e3b33eb5e36761b07a314 (patch)
tree45e9b59b447afd4f6153d371204f4e74c025f2b5 /media
parenta05a8ac5eef083a4c28c1fb4eceea92100cf86a2 (diff)
parent0edefea88e975613bca9f0227614de91434ade11 (diff)
downloadframeworks_base-69d05490345e96e1155e3b33eb5e36761b07a314.zip
frameworks_base-69d05490345e96e1155e3b33eb5e36761b07a314.tar.gz
frameworks_base-69d05490345e96e1155e3b33eb5e36761b07a314.tar.bz2
am 0edefea8: Merge "Fix for 4087846 Crash reported by monkey report (Java/Jni)" into honeycomb-mr1
* commit '0edefea88e975613bca9f0227614de91434ade11': Fix for 4087846 Crash reported by monkey report (Java/Jni)
Diffstat (limited to 'media')
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditorImpl.java12
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorMain.cpp12
2 files changed, 24 insertions, 0 deletions
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
index 78557ee..2105deb 100755
--- a/media/java/android/media/videoeditor/VideoEditorImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -904,6 +904,10 @@ public class VideoEditorImpl implements VideoEditor {
throw new IllegalArgumentException("Surface could not be retrieved from Surface holder");
}
+ if (surface.isValid() == false) {
+ throw new IllegalStateException("Surface is not valid");
+ }
+
if (timeMs < 0) {
throw new IllegalArgumentException("requested time not correct");
} else if (timeMs > mDurationMs) {
@@ -1627,6 +1631,10 @@ public class VideoEditorImpl implements VideoEditor {
throw new IllegalArgumentException("Surface could not be retrieved from surface holder");
}
+ if (surface.isValid() == false) {
+ throw new IllegalStateException("Surface is not valid");
+ }
+
if (listener == null) {
throw new IllegalArgumentException();
}
@@ -1863,6 +1871,10 @@ public class VideoEditorImpl implements VideoEditor {
throw new IllegalArgumentException("Surface could not be retrieved from surface holder");
}
+ if (surface.isValid() == false) {
+ throw new IllegalStateException("Surface is not valid");
+ }
+
if (mMANativeHelper != null) {
mMANativeHelper.clearPreviewSurface(surface);
} else {
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index 8cda14e..11e2a5e 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -557,6 +557,10 @@ static void videoEditor_clearSurface(JNIEnv* pEnv,
Surface* const p = (Surface*)pEnv->GetIntField(surface, surface_native);
sp<Surface> previewSurface = sp<Surface>(p);
+ // Validate the mSurface's mNativeSurface field
+ videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
+ (NULL == previewSurface.get()),
+ "mNativeSurface is null");
frameStr.pBuffer = M4OSA_NULL;
frameStr.timeMs = 0;
@@ -634,6 +638,10 @@ static int videoEditor_renderPreviewFrame(JNIEnv* pEnv,
Surface* const p = (Surface*)pEnv->GetIntField(mSurface, surface_native);
sp<Surface> previewSurface = sp<Surface>(p);
+ // Validate the mSurface's mNativeSurface field
+ videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
+ (NULL == previewSurface.get()),
+ "mNativeSurface is null");
/* Determine the total number of clips, total duration*/
uiNumberOfClipsInStoryBoard = pContext->pEditSettings->uiClipNumber;
@@ -2058,6 +2066,10 @@ videoEditor_startPreview(
Surface* const p = (Surface*)pEnv->GetIntField(mSurface, surface_native);
sp<Surface> previewSurface = sp<Surface>(p);
+ // Validate the mSurface's mNativeSurface field
+ videoEditJava_checkAndThrowIllegalStateException(&needToBeLoaded, pEnv,
+ (NULL == previewSurface.get()),
+ "mNativeSurface is null");
result = pContext->mPreviewController->setSurface(previewSurface);
videoEditJava_checkAndThrowRuntimeException(&needToBeLoaded, pEnv,