am 481ffa50: Merge "Fix for issue 5309336 -add videoeditor maximum prefetch YUV frames in media_profiles.xml to limit the total memory usage." into ics-mr1

* commit '481ffa505bb1d8f5089ea98e3b5960d409b6819c':
  Fix for issue  5309336 -add videoeditor maximum prefetch YUV frames in media_profiles.xml to limit the total memory usage.
This commit is contained in:
Hong Teng
2011-11-15 09:45:29 -08:00
committed by Android Git Automerger
2 changed files with 22 additions and 8 deletions

View File

@ -48,15 +48,21 @@ enum camcorder_quality {
}; };
/** /**
*Set CIF as default maximum import and export resolution of video editor. * Set CIF as default maximum import and export resolution of video editor.
*The maximum import and export resolutions are platform specific, * The maximum import and export resolutions are platform specific,
*which should be defined in media_profiles.xml. * which should be defined in media_profiles.xml.
* Set default maximum prefetch YUV frames to 6, which means video editor can
* queue up to 6 YUV frames in the video encoder source.
* This value is used to limit the amount of memory used by video editor
* engine when the encoder consumes YUV frames at a lower speed
* than video editor engine produces.
*/ */
enum videoeditor_capability { enum videoeditor_capability {
VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352,
VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288,
VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352,
VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288,
VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES = 6
}; };
enum video_decoder { enum video_decoder {
@ -138,6 +144,8 @@ public:
* videoeditor.input.height.max - max input video frame height * videoeditor.input.height.max - max input video frame height
* videoeditor.output.width.max - max output video frame width * videoeditor.output.width.max - max output video frame width
* videoeditor.output.height.max - max output video frame height * videoeditor.output.height.max - max output video frame height
* maxPrefetchYUVFrames - max prefetch YUV frames in video editor engine. This value is used
* to limit the memory consumption.
*/ */
int getVideoEditorCapParamByName(const char *name) const; int getVideoEditorCapParamByName(const char *name) const;
@ -357,11 +365,12 @@ private:
}; };
struct VideoEditorCap { struct VideoEditorCap {
VideoEditorCap(int inFrameWidth, int inFrameHeight, VideoEditorCap(int inFrameWidth, int inFrameHeight,
int outFrameWidth, int outFrameHeight) int outFrameWidth, int outFrameHeight, int frames)
: mMaxInputFrameWidth(inFrameWidth), : mMaxInputFrameWidth(inFrameWidth),
mMaxInputFrameHeight(inFrameHeight), mMaxInputFrameHeight(inFrameHeight),
mMaxOutputFrameWidth(outFrameWidth), mMaxOutputFrameWidth(outFrameWidth),
mMaxOutputFrameHeight(outFrameHeight) {} mMaxOutputFrameHeight(outFrameHeight),
mMaxPrefetchYUVFrames(frames) {}
~VideoEditorCap() {} ~VideoEditorCap() {}
@ -369,6 +378,7 @@ private:
int mMaxInputFrameHeight; int mMaxInputFrameHeight;
int mMaxOutputFrameWidth; int mMaxOutputFrameWidth;
int mMaxOutputFrameHeight; int mMaxOutputFrameHeight;
int mMaxPrefetchYUVFrames;
}; };
int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const; int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;

View File

@ -404,11 +404,12 @@ MediaProfiles::createVideoEditorCap(const char **atts, MediaProfiles *profiles)
CHECK(!strcmp("maxInputFrameWidth", atts[0]) && CHECK(!strcmp("maxInputFrameWidth", atts[0]) &&
!strcmp("maxInputFrameHeight", atts[2]) && !strcmp("maxInputFrameHeight", atts[2]) &&
!strcmp("maxOutputFrameWidth", atts[4]) && !strcmp("maxOutputFrameWidth", atts[4]) &&
!strcmp("maxOutputFrameHeight", atts[6])); !strcmp("maxOutputFrameHeight", atts[6]) &&
!strcmp("maxPrefetchYUVFrames", atts[8]));
MediaProfiles::VideoEditorCap *pVideoEditorCap = MediaProfiles::VideoEditorCap *pVideoEditorCap =
new MediaProfiles::VideoEditorCap(atoi(atts[1]), atoi(atts[3]), new MediaProfiles::VideoEditorCap(atoi(atts[1]), atoi(atts[3]),
atoi(atts[5]), atoi(atts[7])); atoi(atts[5]), atoi(atts[7]), atoi(atts[9]));
logVideoEditorCap(*pVideoEditorCap); logVideoEditorCap(*pVideoEditorCap);
profiles->mVideoEditorCap = pVideoEditorCap; profiles->mVideoEditorCap = pVideoEditorCap;
@ -850,7 +851,8 @@ MediaProfiles::createDefaultVideoEditorCap(MediaProfiles *profiles)
VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH, VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH,
VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT,
VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH,
VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT); VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT,
VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES);
} }
/*static*/ void /*static*/ void
MediaProfiles::createDefaultExportVideoProfiles(MediaProfiles *profiles) MediaProfiles::createDefaultExportVideoProfiles(MediaProfiles *profiles)
@ -1019,6 +1021,8 @@ int MediaProfiles::getVideoEditorCapParamByName(const char *name) const
return mVideoEditorCap->mMaxOutputFrameWidth; return mVideoEditorCap->mMaxOutputFrameWidth;
if (!strcmp("videoeditor.output.height.max", name)) if (!strcmp("videoeditor.output.height.max", name))
return mVideoEditorCap->mMaxOutputFrameHeight; return mVideoEditorCap->mMaxOutputFrameHeight;
if (!strcmp("maxPrefetchYUVFrames", name))
return mVideoEditorCap->mMaxPrefetchYUVFrames;
LOGE("The given video editor param name %s is not found", name); LOGE("The given video editor param name %s is not found", name);
return -1; return -1;