am d4c5478a: Merge "Be conservative in estimating the file size limit." into gingerbread

* commit 'd4c5478a8664f64ff66db9ae25250afac78b7a74':
  Be conservative in estimating the file size limit.
This commit is contained in:
James Dong
2010-12-02 10:21:06 -08:00
committed by Android Git Automerger
2 changed files with 12 additions and 1 deletions

View File

@@ -361,6 +361,9 @@ status_t StagefrightRecorder::setParamMaxFileDurationUs(int64_t timeUs) {
return BAD_VALUE;
}
if (timeUs <= 15 * 1000000LL) {
LOGW("Target duration (%lld us) too short to be respected", timeUs);
}
mMaxFileDurationUs = timeUs;
return OK;
}
@@ -371,6 +374,11 @@ status_t StagefrightRecorder::setParamMaxFileSizeBytes(int64_t bytes) {
LOGE("Max file size is too small: %lld bytes", bytes);
return BAD_VALUE;
}
if (bytes <= 100 * 1024) {
LOGW("Target file size (%lld bytes) is too small to be respected", bytes);
}
mMaxFileSizeBytes = bytes;
return OK;
}

View File

@@ -863,7 +863,10 @@ bool MPEG4Writer::exceedsFileSizeLimit() {
nTotalBytesEstimate += (*it)->getEstimatedTrackSizeBytes();
}
return (nTotalBytesEstimate >= mMaxFileSizeLimitBytes);
// Be conservative in the estimate: do not exceed 95% of
// the target file limit. For small target file size limit, though,
// this will not help.
return (nTotalBytesEstimate >= (95 * mMaxFileSizeLimitBytes) / 100);
}
bool MPEG4Writer::exceedsFileDurationLimit() {