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

Commit be7ac3d6 authored by Johann's avatar Johann
Browse files

fix crash with cues at the beginning of the file

previous implementation tried to be clever about economizing Cue loads.
however, files with the cues at the beginning missed the initial load in
the seek function and would crash with a null pointer.

Change-Id: I49c15d6688909cd13afabf33a54d9f5896aab7cd
parent d22da88f
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -346,9 +346,7 @@ void BlockIterator::seek(
                long len; long long pos;
                pSegment->ParseCues(pEntry->pos, pos, len);
                pCues = pSegment->GetCues();
                // Pull one cue point to fix loop below
                ALOGV("Loading Cue points");
                pCues->LoadCuePoint();
                ALOGV("Cues found");
                break;
            }
        }
@@ -365,16 +363,13 @@ void BlockIterator::seek(

    const mkvparser::CuePoint* pCP;
    while (!pCues->DoneParsing()) {
        // Make sure we don't have the necessary Cue already.
        // If one Cue hadn't been loaded it would need to pre-emptively
        // load one every time (until they are all loaded).
        pCues->LoadCuePoint();
        pCP = pCues->GetLast();

        if (pCP->GetTime(pSegment) >= seekTimeNs) {
            ALOGV("Located segment");
            ALOGV("Parsed past relevant Cue");
            break;
        }

        pCues->LoadCuePoint();
    }

    // Find the video track for seeking. It doesn't make sense to search the