summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorShailendra Yadav <shailendray@google.com>2011-03-14 17:41:53 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-14 17:41:53 -0700
commit6c256d125e465d651cf7f44323113bd8e93f90d5 (patch)
treebf1f4d959542ce4135ef5b17a37a06f009add47f /media/java
parent5c4421f73fe9ce7d9587add4dfa6fdac3b19ca4e (diff)
parente987cbafc2a6c19cae1ccf50658fb6320bda084a (diff)
downloadframeworks_base-6c256d125e465d651cf7f44323113bd8e93f90d5.zip
frameworks_base-6c256d125e465d651cf7f44323113bd8e93f90d5.tar.gz
frameworks_base-6c256d125e465d651cf7f44323113bd8e93f90d5.tar.bz2
am e987cbaf: am 3fabad87: Merge "Fix for Don\'t allow adding 64-bit files(4086708)" into honeycomb-mr1
* commit 'e987cbafc2a6c19cae1ccf50658fb6320bda084a': Fix for Don't allow adding 64-bit files(4086708)
Diffstat (limited to 'media/java')
-rwxr-xr-xmedia/java/android/media/videoeditor/AudioTrack.java7
-rwxr-xr-xmedia/java/android/media/videoeditor/MediaItem.java9
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditor.java5
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditorImpl.java7
4 files changed, 26 insertions, 2 deletions
diff --git a/media/java/android/media/videoeditor/AudioTrack.java b/media/java/android/media/videoeditor/AudioTrack.java
index 7069b23..2de82f2 100755
--- a/media/java/android/media/videoeditor/AudioTrack.java
+++ b/media/java/android/media/videoeditor/AudioTrack.java
@@ -49,7 +49,6 @@ public class AudioTrack {
private final int mAudioType;
private final int mAudioBitrate;
private final int mAudioSamplingFrequency;
-
/**
* Ducking variables
*/
@@ -127,11 +126,17 @@ public class AudioTrack {
int duckThreshold, int duckedTrackVolume,
String audioWaveformFilename) throws IOException {
Properties properties = null;
+
File file = new File(filename);
if (!file.exists()) {
throw new IOException(filename + " not found ! ");
}
+ /*Compare file_size with 2GB*/
+ if (VideoEditor.MAX_SUPPORTED_FILE_SIZE <= file.length()) {
+ throw new IllegalArgumentException("File size is more than 2GB");
+ }
+
if (editor instanceof VideoEditorImpl) {
mMANativeHelper = ((VideoEditorImpl)editor).getNativeContext();
} else {
diff --git a/media/java/android/media/videoeditor/MediaItem.java b/media/java/android/media/videoeditor/MediaItem.java
index dfe0bae..8c4841f 100755
--- a/media/java/android/media/videoeditor/MediaItem.java
+++ b/media/java/android/media/videoeditor/MediaItem.java
@@ -131,6 +131,15 @@ public abstract class MediaItem {
if (filename == null) {
throw new IllegalArgumentException("MediaItem : filename is null");
}
+ File file = new File(filename);
+ if (!file.exists()) {
+ throw new IOException(filename + " not found ! ");
+ }
+
+ /*Compare file_size with 2GB*/
+ if (VideoEditor.MAX_SUPPORTED_FILE_SIZE <= file.length()) {
+ throw new IllegalArgumentException("File size is more than 2GB");
+ }
mUniqueId = mediaItemId;
mFilename = filename;
mRenderingMode = renderingMode;
diff --git a/media/java/android/media/videoeditor/VideoEditor.java b/media/java/android/media/videoeditor/VideoEditor.java
index 122dc8d..59e4540 100755
--- a/media/java/android/media/videoeditor/VideoEditor.java
+++ b/media/java/android/media/videoeditor/VideoEditor.java
@@ -68,6 +68,11 @@ public interface VideoEditor {
public final static int DURATION_OF_STORYBOARD = -1;
/**
+ * Maximum supported file size
+ */
+ public static final long MAX_SUPPORTED_FILE_SIZE = 2147483648L;
+
+ /**
* This listener interface is used by the VideoEditor to emit preview
* progress notifications. This callback should be invoked after the number
* of frames specified by
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
index 7e1f73a..78557ee 100755
--- a/media/java/android/media/videoeditor/VideoEditorImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -119,7 +119,6 @@ public class VideoEditorImpl implements VideoEditor {
private static final String ATTR_OVERLAY_FRAME_HEIGHT = "overlay_frame_height";
private static final String ATTR_OVERLAY_RESIZED_RGB_FRAME_WIDTH = "resized_RGBframe_width";
private static final String ATTR_OVERLAY_RESIZED_RGB_FRAME_HEIGHT = "resized_RGBframe_height";
-
private static final int ENGINE_ACCESS_MAX_TIMEOUT_MS = 500;
/*
* Instance variables
@@ -437,6 +436,12 @@ public class VideoEditorImpl implements VideoEditor {
throw new IllegalArgumentException(message);
}
}
+ computeTimelineDuration();
+ final long audioBitrate = MediaArtistNativeHelper.Bitrate.BR_96_KBPS;
+ final long fileSize = (mDurationMs * (bitrate + audioBitrate)) / 8000;
+ if (MAX_SUPPORTED_FILE_SIZE <= fileSize) {
+ throw new IllegalStateException("Export Size is more than 2GB");
+ }
boolean semAcquireDone = false;
try {