diff options
author | James Dong <jdong@google.com> | 2010-10-06 16:17:14 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-06 16:17:14 -0700 |
commit | eba2d0611923ad75c3b894ebe5ce3d5fc7f6a946 (patch) | |
tree | 10a20b23aecb65c2e05adb4c9fe634c0699aec04 | |
parent | 8805043df9bba6206839b3a754f2bca4f62a1721 (diff) | |
parent | 11e69dea99ca2ace7bf8eb56ce6f6528fc906813 (diff) | |
download | frameworks_av-eba2d0611923ad75c3b894ebe5ce3d5fc7f6a946.zip frameworks_av-eba2d0611923ad75c3b894ebe5ce3d5fc7f6a946.tar.gz frameworks_av-eba2d0611923ad75c3b894ebe5ce3d5fc7f6a946.tar.bz2 |
am a86a6c4e: am 6f1c7bda: Merge "Fixed an issue where the reserved free space in the file writer was larger than intended" into gingerbread
Merge commit 'a86a6c4e326bfdfc351dacca95b23bb78f78efbe'
* commit 'a86a6c4e326bfdfc351dacca95b23bb78f78efbe':
Fixed an issue where the reserved free space in the file writer was larger than intended
-rw-r--r-- | include/media/stagefright/MPEG4Writer.h | 1 | ||||
-rw-r--r-- | media/libstagefright/MPEG4Writer.cpp | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index 70bd8e8..cff38b2 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -64,6 +64,7 @@ private: FILE *mFile; bool mUse4ByteNalLength; bool mUse32BitOffset; + bool mIsFileSizeLimitExplicitlyRequested; bool mPaused; bool mStarted; off_t mOffset; diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 90b1aab..6d00d7c 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -212,6 +212,7 @@ MPEG4Writer::MPEG4Writer(const char *filename) : mFile(fopen(filename, "wb")), mUse4ByteNalLength(true), mUse32BitOffset(true), + mIsFileSizeLimitExplicitlyRequested(false), mPaused(false), mStarted(false), mOffset(0), @@ -225,6 +226,7 @@ MPEG4Writer::MPEG4Writer(int fd) : mFile(fdopen(fd, "wb")), mUse4ByteNalLength(true), mUse32BitOffset(true), + mIsFileSizeLimitExplicitlyRequested(false), mPaused(false), mStarted(false), mOffset(0), @@ -322,7 +324,7 @@ int64_t MPEG4Writer::estimateMoovBoxSize(int32_t bitRate) { static const int64_t MAX_MOOV_BOX_SIZE = (180 * 3000000 * 6LL / 8000); int64_t size = MIN_MOOV_BOX_SIZE; - if (mMaxFileSizeLimitBytes != 0) { + if (mMaxFileSizeLimitBytes != 0 && mIsFileSizeLimitExplicitlyRequested) { size = mMaxFileSizeLimitBytes * 4 / 1000; } else if (mMaxFileDurationLimitUs != 0) { if (bitRate <= 0) { @@ -342,7 +344,7 @@ int64_t MPEG4Writer::estimateMoovBoxSize(int32_t bitRate) { size = MAX_MOOV_BOX_SIZE; } - LOGV("limits: %lld/%lld bytes/us, bit rate: %d bps and the estimated" + LOGI("limits: %lld/%lld bytes/us, bit rate: %d bps and the estimated" " moov size %lld bytes", mMaxFileSizeLimitBytes, mMaxFileDurationLimitUs, bitRate, size); return factor * size; @@ -353,6 +355,16 @@ status_t MPEG4Writer::start(MetaData *param) { return UNKNOWN_ERROR; } + /* + * Check mMaxFileSizeLimitBytes at the beginning + * since mMaxFileSizeLimitBytes may be implicitly + * changed later for 32-bit file offset even if + * user does not ask to set it explicitly. + */ + if (mMaxFileSizeLimitBytes != 0) { + mIsFileSizeLimitExplicitlyRequested = true; + } + int32_t use64BitOffset; if (param && param->findInt32(kKey64BitFileOffset, &use64BitOffset) && |