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

Commit 94892a98 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "unique_fd is passed by value in AIDL interfaces"

parents 5d88745d 51207514
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -418,7 +418,7 @@ void NuPlayer::GenericSource::onPrepareAsync() {
                    sp<IMediaExtractorService> mediaExService(
                            interface_cast<IMediaExtractorService>(binder));
                    sp<IDataSource> source;
                    mediaExService->makeIDataSource(mFd, mOffset, mLength, &source);
                    mediaExService->makeIDataSource(base::unique_fd(dup(mFd.get())), mOffset, mLength, &source);
                    ALOGV("IDataSource(FileSource): %p %d %lld %lld",
                            source.get(), mFd.get(), (long long)mOffset, (long long)mLength);
                    if (source.get() != nullptr) {
+2 −4
Original line number Diff line number Diff line
@@ -61,13 +61,11 @@ MediaExtractorService::~MediaExtractorService() {
}

::android::binder::Status MediaExtractorService::makeIDataSource(
        const base::unique_fd &fd,
        base::unique_fd fd,
        int64_t offset,
        int64_t length,
        ::android::sp<::android::IDataSource>* _aidl_return) {
    // the caller will close the fd owned by the unique_fd upon return of this function,
    // so we need to dup() it to retain it.
    sp<DataSource> source = DataSourceFactory::getInstance()->CreateFromFd(dup(fd.get()), offset, length);
    sp<DataSource> source = DataSourceFactory::getInstance()->CreateFromFd(fd.release(), offset, length);
    *_aidl_return = CreateIDataSourceFromDataSource(source);
    return binder::Status::ok();
}
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ public:
            ::android::sp<::android::IMediaExtractor>* _aidl_return);

    virtual ::android::binder::Status makeIDataSource(
            const base::unique_fd &fd,
            base::unique_fd fd,
            int64_t offset,
            int64_t length,
            ::android::sp<::android::IDataSource>* _aidl_return);