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

Commit b8111f83 authored by Marco Nelissen's avatar Marco Nelissen Committed by Gerrit Code Review
Browse files

Merge "Fix potential double close in IMediaMetadataRetriever::setDataSource"

parents 75781346 55203e2e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ status_t BnMediaMetadataRetriever::onTransact(
        } break;
        case SET_DATA_SOURCE_FD: {
            CHECK_INTERFACE(IMediaMetadataRetriever, data, reply);
            int fd = dup(data.readFileDescriptor());
            int fd = data.readFileDescriptor();
            int64_t offset = data.readInt64();
            int64_t length = data.readInt64();
            reply->writeInt32(setDataSource(fd, offset, length));
+0 −1
Original line number Diff line number Diff line
@@ -748,7 +748,6 @@ status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64

    if (offset >= sb.st_size) {
        ALOGE("offset error");
        ::close(fd);
        return UNKNOWN_ERROR;
    }
    if (offset + length > sb.st_size) {
+0 −3
Original line number Diff line number Diff line
@@ -148,7 +148,6 @@ status_t MetadataRetrieverClient::setDataSource(int fd, int64_t offset, int64_t

    if (offset >= sb.st_size) {
        ALOGE("offset (%lld) bigger than file size (%llu)", offset, sb.st_size);
        ::close(fd);
        return BAD_VALUE;
    }
    if (offset + length > sb.st_size) {
@@ -164,12 +163,10 @@ status_t MetadataRetrieverClient::setDataSource(int fd, int64_t offset, int64_t
    ALOGV("player type = %d", playerType);
    sp<MediaMetadataRetrieverBase> p = createRetriever(playerType);
    if (p == NULL) {
        ::close(fd);
        return NO_INIT;
    }
    status_t status = p->setDataSource(fd, offset, length);
    if (status == NO_ERROR) mRetriever = p;
    ::close(fd);
    return status;
}

+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ status_t StagefrightPlayer::setDataSource(
// the method returns, if you want to keep it, dup it!
status_t StagefrightPlayer::setDataSource(int fd, int64_t offset, int64_t length) {
    ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
    return mPlayer->setDataSource(dup(fd), offset, length);
    return mPlayer->setDataSource(fd, offset, length);
}

status_t StagefrightPlayer::setDataSource(const sp<IStreamSource> &source) {
+1 −0
Original line number Diff line number Diff line
@@ -341,6 +341,7 @@ status_t AwesomePlayer::setDataSource(

    reset_l();

    fd = dup(fd);
    sp<DataSource> dataSource = new FileSource(fd, offset, length);

    status_t err = dataSource->initCheck();