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

Commit fb45748a authored by Nipun Kwatra's avatar Nipun Kwatra
Browse files

setParamMaxFileDurationUs should allow zero time input as per API of setMaxDuration.

according to MediaRecorder::setMaxDuration documentation we should disable duration limit
when zero or negative time is passed. Currently setParamMaxFileDurationUs was treating
zero/negative as an error case. Fixed that.

Change-Id: I468c3bcc74cb5a34ee3e172cef5147550d6be096
parent 4d42ccd1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -341,10 +341,14 @@ status_t StagefrightRecorder::setParamVideoEncodingBitRate(int32_t bitRate) {

status_t StagefrightRecorder::setParamMaxFileDurationUs(int64_t timeUs) {
    LOGV("setParamMaxFileDurationUs: %lld us", timeUs);
    if (timeUs <= 100000LL) {  // XXX: 100 milli-seconds
    if (timeUs <= 0) {
        LOGW("Max file duration is not positive: %lld us. Disabling duration limit.", timeUs);
        timeUs = 0; // Disable the duration limit for zero or negative values.
    } else if (timeUs <= 100000LL) {  // XXX: 100 milli-seconds
        LOGE("Max file duration is too short: %lld us", timeUs);
        return BAD_VALUE;
    }

    mMaxFileDurationUs = timeUs;
    return OK;
}