Getting AMEDIA_ERROR_BASE what is a problem here?

  android, android-mediacodec, c++, native
int32_t NDK_extractor::decode(const unsigned char *pData, long dataSize)
{
    LOGD("Using NDK decoder");
    FILE *fp = nullptr;
    media_status_t err;

    AMediaExtractor *ex = AMediaExtractor_new();

    fp = fmemopen((void *) pData, dataSize, "rb");

    if (fp)
    {
        err = AMediaExtractor_setDataSourceFd(ex, fileno(fp), 0 /*offset*/, dataSize);
    }
    else
    {
        LOGE("Failed open file");
        return 0;
    }

    if (err != AMEDIA_OK)
    {
        LOGE("SOUND :: Error setting ex data source, err %d", err);  <----- THIS LINE
        return 0;
    }
...
}

I try to use setDataSource method from AMediaExtractor and getting such an error AMEDIA_ERROR_BASE

What am I doing wrong?

Source: Windows Questions C++

LEAVE A COMMENT