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

Commit e941bda6 authored by Andy Hung's avatar Andy Hung Committed by android-build-merger
Browse files

Merge "GenericSource: close unused file descriptor" into oc-dev

am: 76e36033

Change-Id: Iee6c29c26709b8dee43551e553cddd3d9ee225b8
parents af68d9aa 76e36033
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -379,6 +379,11 @@ void NuPlayer::GenericSource::onPrepareAsync() {
                            source.get(), mFd, (long long)mOffset, (long long)mLength);
                    if (source.get() != nullptr) {
                        mDataSource = DataSource::CreateFromIDataSource(source);
                        if (mDataSource != nullptr) {
                            // Close the local file descriptor as it is not needed anymore.
                            close(mFd);
                            mFd = -1;
                        }
                    } else {
                        ALOGW("extractor service cannot make data source");
                    }
@@ -390,7 +395,9 @@ void NuPlayer::GenericSource::onPrepareAsync() {
                ALOGD("FileSource local");
                mDataSource = new FileSource(mFd, mOffset, mLength);
            }

            // TODO: close should always be done on mFd, see the lines following
            // DataSource::CreateFromIDataSource above,
            // and the FileSource constructor should dup the mFd argument as needed.
            mFd = -1;
        }