summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-08-27 14:33:54 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-27 14:33:54 -0700
commitdf8356ff9a2f1fab44bb3aea26c5da0a9f23a4ad (patch)
treedeef441c28ac032ba33bab5eb81cdacac73da785
parentd851e6fea59bcc5a9ad4ddcdfde63e9443640ef2 (diff)
parent90862e2a8b3ea522cf1dace5e93dcec109a1aa85 (diff)
downloadframeworks_base-df8356ff9a2f1fab44bb3aea26c5da0a9f23a4ad.zip
frameworks_base-df8356ff9a2f1fab44bb3aea26c5da0a9f23a4ad.tar.gz
frameworks_base-df8356ff9a2f1fab44bb3aea26c5da0a9f23a4ad.tar.bz2
Merge "Workaround for a QCOM issue where the output buffer size advertised by the AVC encoder is occasionally too small." into gingerbread
-rw-r--r--include/media/stagefright/OMXCodec.h1
-rw-r--r--media/libstagefright/OMXCodec.cpp13
2 files changed, 14 insertions, 0 deletions
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index 010ded1..875bc5b 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -102,6 +102,7 @@ private:
kInputBufferSizesAreBogus = 512,
kSupportsMultipleFramesPerInputBuffer = 1024,
kAvoidMemcopyInputRecordingFrames = 2048,
+ kRequiresLargerEncoderOutputBuffer = 4096,
};
struct BufferInfo {
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 4741b1d..165cec9 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -353,6 +353,15 @@ uint32_t OMXCodec::getComponentQuirks(const char *componentName) {
quirks |= kRequiresLoadedToIdleAfterAllocation;
quirks |= kRequiresAllocateBufferOnInputPorts;
quirks |= kRequiresAllocateBufferOnOutputPorts;
+ if (!strncmp(componentName, "OMX.qcom.video.encoder.avc", 26)) {
+
+ // The AVC encoder advertises the size of output buffers
+ // based on the input video resolution and assumes
+ // the worst/least compression ratio is 0.5. It is found that
+ // sometimes, the output buffer size is larger than
+ // size advertised by the encoder.
+ quirks |= kRequiresLargerEncoderOutputBuffer;
+ }
}
if (!strncmp(componentName, "OMX.qcom.7x30.video.encoder.", 28)) {
}
@@ -906,6 +915,10 @@ void OMXCodec::setVideoInputFormat(
video_def->nBitrate = bitRate; // Q16 format
video_def->eCompressionFormat = compressionFormat;
video_def->eColorFormat = OMX_COLOR_FormatUnused;
+ if (mQuirks & kRequiresLargerEncoderOutputBuffer) {
+ // Increases the output buffer size
+ def.nBufferSize = ((def.nBufferSize * 3) >> 1);
+ }
err = mOMX->setParameter(
mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));