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

Commit 471f8f03 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

am: e941bda6

Change-Id: I793c711309c7c6648f7083db4ce67e5b79696ee5
parents 725cb1e5 e941bda6
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;
        }