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

Commit a0b8b596 authored by Marco Nelissen's avatar Marco Nelissen Committed by android-build-merger
Browse files

Merge "Improve seeking for Xing header without TOC" am: cd17b745 am: 28301383

am: 1204711c

Change-Id: If1e9f7aa7c92f5bacdcebea3c7a6be61ea53ba8a
parents cb82c801 1204711c
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@ bool XINGSeeker::getDuration(int64_t *durationUs) {
}
}


bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
    if (mSizeBytes == 0 || !mTOCValid || mDurationUs < 0) {
    if (mSizeBytes == 0 || mDurationUs < 0) {
        return false;
        return false;
    }
    }


@@ -54,7 +54,7 @@ bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
        fx = 0.0f;
        fx = 0.0f;
    } else if( percent >= 100.0f ) {
    } else if( percent >= 100.0f ) {
        fx = 256.0f;
        fx = 256.0f;
    } else {
    } else if (mTOCValid) {
        int a = (int)percent;
        int a = (int)percent;
        float fa, fb;
        float fa, fb;
        if ( a == 0 ) {
        if ( a == 0 ) {
@@ -68,6 +68,8 @@ bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) {
            fb = 256.0f;
            fb = 256.0f;
        }
        }
        fx = fa + (fb-fa)*(percent-a);
        fx = fa + (fb-fa)*(percent-a);
    } else {
        fx = percent * 2.56f;
    }
    }


    *pos = (int)((1.0f/256.0f)*fx*mSizeBytes) + mFirstFramePos;
    *pos = (int)((1.0f/256.0f)*fx*mSizeBytes) + mFirstFramePos;