diff options
| author | Gil Dobjanschi <virgild@google.com> | 2011-01-27 10:36:33 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-01-27 10:36:33 -0800 |
| commit | 6adcce8a5751b0afba86a55f600aa1f14a56d03c (patch) | |
| tree | ea349c10dca680155c2c59eeac1c1cd770c00f0d | |
| parent | 70085101b2c33918510def0378818aec6e109d80 (diff) | |
| parent | 0966fb9e73345b1e5ea9464e77beed07378edd6a (diff) | |
| download | frameworks_base-6adcce8a5751b0afba86a55f600aa1f14a56d03c.zip frameworks_base-6adcce8a5751b0afba86a55f600aa1f14a56d03c.tar.gz frameworks_base-6adcce8a5751b0afba86a55f600aa1f14a56d03c.tar.bz2 | |
am 0966fb9e: am eea200a9: Bug fix: 3398192 NPE at android.media.videoeditor.VideoEditorImpl.clearSurface
* commit '0966fb9e73345b1e5ea9464e77beed07378edd6a':
Bug fix: 3398192 NPE at android.media.videoeditor.VideoEditorImpl.clearSurface
| -rwxr-xr-x | media/java/android/media/videoeditor/VideoEditorImpl.java | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java index a590eec..54b3837 100755 --- a/media/java/android/media/videoeditor/VideoEditorImpl.java +++ b/media/java/android/media/videoeditor/VideoEditorImpl.java @@ -424,7 +424,7 @@ public class VideoEditorImpl implements VideoEditor { mMediaItems, mTransitions, mAudioTracks, listener); } catch (InterruptedException ex) { - Log.e("VideoEditorImpl", "Sem acquire NOT successful in export"); + Log.e(TAG, "Sem acquire NOT successful in export"); } finally { mExportSemaphore.release(); } @@ -444,7 +444,7 @@ public class VideoEditorImpl implements VideoEditor { mAudioTracks, listener); } } catch (InterruptedException ex) { - Log.e("VideoEditorImpl", "Sem acquire NOT successful in previewStoryBoard"); + Log.e(TAG, "Sem acquire NOT successful in previewStoryBoard"); } finally { if (semAcquireDone) { mPreviewSemaphore.release(); @@ -891,7 +891,7 @@ public class VideoEditorImpl implements VideoEditor { } } catch (InterruptedException ex) { - Log.e("VideoEditorImpl", "Sem acquire NOT successful in renderPreviewFrame"); + Log.e(TAG, "Sem acquire NOT successful in renderPreviewFrame"); } finally { if (semAcquireDone) { @@ -1567,16 +1567,14 @@ public class VideoEditorImpl implements VideoEditor { mPreviewSemaphore.acquire(); semAcquireDone = true; } catch (InterruptedException ex) { - Log.e("VideoEditorImpl", "Sem acquire NOT successful in startPreview"); + Log.e(TAG, "Sem acquire NOT successful in startPreview"); } if (semAcquireDone) { Surface mSurface = surfaceHolder.getSurface(); if (mSurface == null) { - Log.e("VideoEditoeImpl", - "Surface could not be retrieved from surface holder"); throw new - RuntimeException(); + throw new RuntimeException("Surface could not be retrieved from surface holder"); } if (mMediaItems.size() > 0) { @@ -1588,15 +1586,15 @@ public class VideoEditorImpl implements VideoEditor { mPreviewInProgress = true; } catch (IllegalArgumentException ex) { mPreviewSemaphore.release(); - Log.e("VideoEditorImpl", "Illegal Argument exception in do preview"); + Log.e(TAG, "Illegal Argument exception in do preview"); throw ex; } catch (IllegalStateException ex) { mPreviewSemaphore.release(); - Log.e("VideoEditorImpl", "Illegal State exception in do preview"); + Log.e(TAG, "Illegal State exception in do preview"); throw ex; } catch (RuntimeException ex) { mPreviewSemaphore.release(); - Log.e("VideoEditorImpl", "Runtime exception in do preview"); + Log.e(TAG, "Runtime exception in do preview"); throw ex; } } @@ -1732,7 +1730,7 @@ public class VideoEditorImpl implements VideoEditor { if (mMediaItems.size() > 0) { MediaItem mI = mMediaItems.get(0); /* - * Lets initialise the width for default aspect ratio i.e 16:9 + * Lets initialiZe the width for default aspect ratio i.e 16:9 */ int height = 480; int width = 854; @@ -1784,18 +1782,19 @@ public class VideoEditorImpl implements VideoEditor { * and needs to be cleared. */ public void clearSurface(SurfaceHolder surfaceHolder) { + if (surfaceHolder == null) { + throw new IllegalArgumentException("Invalid surface holder"); + } - if (surfaceHolder == null) { - throw new IllegalArgumentException(); - } - Surface surface = surfaceHolder.getSurface(); - - if (surface == null) { - Log.e("VideoEditorImpl", - "Surface could not be retrieved from surface holder"); - throw new RuntimeException(); - } - mMANativeHelper.clearPreviewSurface(surface); - } + final Surface surface = surfaceHolder.getSurface(); + if (surface == null) { + throw new RuntimeException("Surface could not be retrieved from surface holder"); + } + if (mMANativeHelper != null) { + mMANativeHelper.clearPreviewSurface(surface); + } else { + Log.w(TAG, "Native helper was not ready!"); + } + } } |
