summaryrefslogtreecommitdiffstats
path: root/media/mca
diff options
context:
space:
mode:
authorPannag Sanketi <psanketi@google.com>2012-05-21 18:08:35 -0700
committerPannag Sanketi <psanketi@google.com>2012-05-23 16:40:31 -0700
commit58acf44b9f16d5154e6d3a0e5f7a7a7a3c7b423f (patch)
tree848d15fdcf5c577e20696712796d6010407a6fb8 /media/mca
parent956f28edae64268a67af22baee2ef873264921b4 (diff)
downloadframeworks_base-58acf44b9f16d5154e6d3a0e5f7a7a7a3c7b423f.zip
frameworks_base-58acf44b9f16d5154e6d3a0e5f7a7a7a3c7b423f.tar.gz
frameworks_base-58acf44b9f16d5154e6d3a0e5f7a7a7a3c7b423f.tar.bz2
Fix bad aspect ratios for recorded effects
Fix b/6530189 Fix b/6535207 Change-Id: I6ef09bd619acc31af53d9991335cda33b7c08908
Diffstat (limited to 'media/mca')
-rw-r--r--media/mca/filterpacks/java/android/filterpacks/videosink/MediaEncoderFilter.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/media/mca/filterpacks/java/android/filterpacks/videosink/MediaEncoderFilter.java b/media/mca/filterpacks/java/android/filterpacks/videosink/MediaEncoderFilter.java
index d8aa40f..8bb653b 100644
--- a/media/mca/filterpacks/java/android/filterpacks/videosink/MediaEncoderFilter.java
+++ b/media/mca/filterpacks/java/android/filterpacks/videosink/MediaEncoderFilter.java
@@ -111,12 +111,12 @@ public class MediaEncoderFilter extends Filter {
/** Frame width to be encoded, defaults to 320.
* Actual received frame size has to match this */
@GenerateFieldPort(name = "width", hasDefault = true)
- private int mWidth = 320;
+ private int mWidth = 0;
/** Frame height to to be encoded, defaults to 240.
* Actual received frame size has to match */
@GenerateFieldPort(name = "height", hasDefault = true)
- private int mHeight = 240;
+ private int mHeight = 0;
/** Stream framerate to encode the frames at.
* By default, frames are encoded at 30 FPS*/
@@ -245,6 +245,11 @@ public class MediaEncoderFilter extends Filter {
if (mProfile != null) {
mMediaRecorder.setProfile(mProfile);
mFps = mProfile.videoFrameRate;
+ // If width and height are set larger than 0, then those
+ // overwrite the ones in the profile.
+ if (mWidth > 0 && mHeight > 0) {
+ mMediaRecorder.setVideoSize(mWidth, mHeight);
+ }
} else {
mMediaRecorder.setOutputFormat(mOutputFormat);
mMediaRecorder.setVideoEncoder(mVideoEncoder);
@@ -298,7 +303,10 @@ public class MediaEncoderFilter extends Filter {
screenFormat.setBytesPerSample(4);
int width, height;
- if (mProfile != null) {
+ boolean widthHeightSpecified = mWidth > 0 && mHeight > 0;
+ // If width and height are specified, then use those instead
+ // of that in the profile.
+ if (mProfile != null && !widthHeightSpecified) {
width = mProfile.videoFrameWidth;
height = mProfile.videoFrameHeight;
} else {
@@ -410,7 +418,6 @@ public class MediaEncoderFilter extends Filter {
// And swap buffers
glEnv.swapBuffers();
mNumFramesEncoded++;
- if (mLogVerbose) Log.v(TAG, "numFramesEncoded = " + mNumFramesEncoded);
}
private void stopRecording(FilterContext context) {