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

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

Merge "Fix a race condition in the prefetcher, the source may be shutdown...

Merge "Fix a race condition in the prefetcher, the source may be shutdown while we're reading data from it."
parents 8a032a3b 397afb54
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -337,7 +337,6 @@ bool PrefetchedSource::getCacheDurationUs(int64_t *durationUs) {
void PrefetchedSource::cacheMore() {
    MediaSource::ReadOptions options;

    {
    Mutex::Autolock autoLock(mLock);

    if (!mStarted) {
@@ -348,13 +347,10 @@ void PrefetchedSource::cacheMore() {
        options.setSeekTo(mSeekTimeUs);
        mSeekTimeUs = -1;
    }
    }

    MediaBuffer *buffer;
    status_t err = mSource->read(&buffer, &options);

    Mutex::Autolock autoLock(mLock);

    if (err != OK) {
        mReachedEOS = true;
        mCondition.signal();