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

Commit ec9459c6 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "close fd if data source is reset without prepare" into lmp-mr1-dev

parents a7cf01da a6bf21f2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ NuPlayer::GenericSource::GenericSource(
      mIsWidevine(false),
      mUIDValid(uidValid),
      mUID(uid),
      mFd(-1),
      mDrmManagerClient(NULL),
      mMetaDataSize(-1ll),
      mBitrate(-1ll),
@@ -70,7 +71,10 @@ void NuPlayer::GenericSource::resetDataSource() {
    mHttpSource.clear();
    mUri.clear();
    mUriHeaders.clear();
    if (mFd >= 0) {
        close(mFd);
        mFd = -1;
    }
    mOffset = 0;
    mLength = 0;
    setDrmPlaybackStatusIfNeeded(Playback::STOP, 0);
@@ -270,6 +274,7 @@ NuPlayer::GenericSource::~GenericSource() {
        mLooper->unregisterHandler(id());
        mLooper->stop();
    }
    resetDataSource();
}

void NuPlayer::GenericSource::prepareAsync() {
@@ -312,6 +317,7 @@ void NuPlayer::GenericSource::onPrepareAsync() {
            mIsWidevine = false;

            mDataSource = new FileSource(mFd, mOffset, mLength);
            mFd = -1;
        }

        if (mDataSource == NULL) {