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

Commit 5ce9c299 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Instead of returning an error, return an invalid duration (-1 ms)" into jb-mr2-dev

parents 7455393a d85929f6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -398,6 +398,13 @@ status_t MediaPlayer::getDuration_l(int *msec)
    if (mPlayer != 0 && isValidState) {
        int durationMs;
        status_t ret = mPlayer->getDuration(&durationMs);

        if (ret != OK) {
            // Do not enter error state just because no duration was available.
            durationMs = -1;
            ret = OK;
        }

        if (msec) {
            *msec = durationMs;
        }
+3 −3
Original line number Diff line number Diff line
@@ -314,11 +314,11 @@ status_t NuPlayerDriver::getDuration(int *msec) {
    Mutex::Autolock autoLock(mLock);

    if (mDurationUs < 0) {
        *msec = 0;
    } else {
        *msec = (mDurationUs + 500ll) / 1000;
        return UNKNOWN_ERROR;
    }

    *msec = (mDurationUs + 500ll) / 1000;

    return OK;
}