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

Commit 96eb2b8a authored by Paras Nagda's avatar Paras Nagda Committed by Linux Build Service Account
Browse files

libstagefright: Fix MPEG4Writer crash when internal memory is almost full.

 - Camcoder recording crashes when internal memory is almost full.
 - crash happens if there is no space to write even first video frame.
   as soon as first video frame comes file limit exceeded information
   is given back to recorder and timestamp of video is not updated.
   since video timestamp is not proper crash is seen
   when comparing it with audio timestamp.
 - check is added while doing comparision of timestamps and
   reporting error in track stop() so recorded file is not saved to
   memory.

Change-Id: I69e8bad62ab03ce01de5cbdb13f8ea841b787fcb
parent 1fc086f2
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1881,6 +1881,10 @@ status_t MPEG4Writer::Track::stop() {
    status_t err = static_cast<status_t>(reinterpret_cast<uintptr_t>(dummy));

    ALOGD("%s track stopped", mIsAudio? "Audio": "Video");
    if (mOwner->exceedsFileSizeLimit() && mStszTableEntries->count() == 0) {
        ALOGE(" Filesize limit exceeded and zero samples written ");
        return ERROR_END_OF_STREAM;
    }
    return err;
}

@@ -3086,7 +3090,7 @@ void MPEG4Writer::Track::writePaspBox() {
int32_t MPEG4Writer::Track::getStartTimeOffsetScaledTime() const {
    int64_t trackStartTimeOffsetUs = 0;
    int64_t moovStartTimeUs = mOwner->getStartTimestampUs();
    if (mStartTimestampUs != moovStartTimeUs) {
    if (mStartTimestampUs != moovStartTimeUs && mStszTableEntries->count() != 0) {
        CHECK_GT(mStartTimestampUs, moovStartTimeUs);
        trackStartTimeOffsetUs = mStartTimestampUs - moovStartTimeUs;
    }