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

Commit fd7ec80f authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Fix deadlock

I wanted to save some space, and ended up with a deadlock.
This change basically restores setDataSource(fd, offset, size) to the
way it was before I added the new setDataSource(DataSource) method,
instead of calling through to it.

Change-Id: Iacf4627c8745369fa84b467530189a9f64f8726b
parent ff3f75c3
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ status_t NuMediaExtractor::setDataSource(
}

status_t NuMediaExtractor::setDataSource(int fd, off64_t offset, off64_t size) {

    Mutex::Autolock autoLock(mLock);

    if (mImpl != NULL) {
@@ -134,7 +135,22 @@ status_t NuMediaExtractor::setDataSource(int fd, off64_t offset, off64_t size) {

    sp<FileSource> fileSource = new FileSource(dup(fd), offset, size);

    return setDataSource(fileSource);
    status_t err = fileSource->initCheck();
    if (err != OK) {
        return err;
    }

    mImpl = MediaExtractor::Create(fileSource);

    if (mImpl == NULL) {
        return ERROR_UNSUPPORTED;
    }

    mDataSource = fileSource;

    updateDurationAndBitrate();

    return OK;
}

status_t NuMediaExtractor::setDataSource(const sp<DataSource> &source) {