Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6785699f authored by James Dong's avatar James Dong Committed by Android Git Automerger
Browse files

am 80639875: am d4c5478a: Merge "Be conservative in estimating the file size...

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

* commit '80639875':
  Be conservative in estimating the file size limit.
parents d66c63e5 80639875
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -366,6 +366,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;
}
@@ -376,6 +379,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;
}
+4 −1
Original line number Diff line number Diff line
@@ -878,7 +878,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() {