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

Commit 4822ffc9 authored by Haynes Mathew George's avatar Haynes Mathew George Committed by Steve Kondik
Browse files

frameworks/av: miscellaneous fixes

fixes for the following issues reported by KW

5978, 8879, 8880, 8881, 8882, 8883, 8889, 8890,
8892, 8893, 9200, 9201, 10210, 11223, 11224, 18001,
83677, 84525, 5897

Change-Id: I9bb98a07af97cbfc746b21738dfce7cd9e128c94
(cherry picked from commit 331e8cc1)
parent 7816dee4
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
@@ -313,6 +313,13 @@ int EffectCreate(const effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, eff

    // add entry to effect list
    fx = (effect_entry_t *)malloc(sizeof(effect_entry_t));

    if (!fx) {
        ALOGE("failed to allocate effect_entry");
        ret = -ENOMEM;
        goto exit;
    }

    fx->subItfe = itfe;
    if ((*itfe)->process_reverse != NULL) {
        fx->itfe = (struct effect_interface_s *)&gInterfaceWithReverse;
@@ -324,6 +331,11 @@ int EffectCreate(const effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, eff
    fx->lib = l;

    e = (list_elem_t *)malloc(sizeof(list_elem_t));
    if (!e) {
        ret = -ENOMEM;
        goto exit;
    }

    e->object = fx;
    e->next = gEffectList;
    gEffectList = e;
@@ -470,6 +482,9 @@ int loadEffectConfigFile(const char *path)
        return -ENODEV;
    }
    root = config_node("", "");
    if (root == NULL) {
        return -ENOMEM;
    }
    config_load(root, data);
    loadLibraries(root);
    loadEffects(root);
@@ -534,6 +549,12 @@ int loadLibrary(cnode *root, const char *name)

    // add entry for library in gLibraryList
    l = malloc(sizeof(lib_entry_t));

    if (!l) {
        ALOGE("failed to allocate lib_entry_t");
        goto error;
    }

    l->name = strndup(name, PATH_MAX);
    l->path = strndup(node->value, PATH_MAX);
    l->handle = hdl;
@@ -606,10 +627,21 @@ int addSubEffect(cnode *root)
        return -EINVAL;
    }
    sub_effect_entry_t *sub_effect = malloc(sizeof(sub_effect_entry_t));

    if (!sub_effect) {
        ALOGE("failed to allocate sub effect memory");
        return -ENOMEM;
    }

    sub_effect->object = d;
    // lib_entry_t is stored since the sub effects are not linked to the library
    sub_effect->lib = l;
    e = malloc(sizeof(list_elem_t));
    if (!e) {
        ALOGE("failed to allocate list elem memory");
        return -ENOMEM;
    }

    e->object = sub_effect;
    e->next = gSubEffectList->sub_elem;
    gSubEffectList->sub_elem = e;
@@ -681,6 +713,10 @@ int loadEffect(cnode *root)
        return -EINVAL;
    }
    e = malloc(sizeof(list_elem_t));
    if (!e) {
        return -ENOMEM;
    }

    e->object = d;
    e->next = l->effects;
    l->effects = e;
@@ -695,6 +731,11 @@ int loadEffect(cnode *root)
    if (node != NULL) {
        ALOGV("Adding the effect to gEffectSubList as there are sub effects");
        sube = malloc(sizeof(list_sub_elem_t));
        if (!sube) {
            ALOGE("failed to allocate sub element list");
            return -ENOMEM;
        }

        sube->object = d;
        sube->sub_elem = NULL;
        sube->next = gSubEffectList;
+5 −0
Original line number Diff line number Diff line
@@ -617,6 +617,11 @@ audio_io_handle_t AudioSystem::getOutput(audio_stream_type_t stream,
{
    const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
    if (aps == 0) return 0;

    if (stream == AUDIO_STREAM_DEFAULT) {
        stream = AUDIO_STREAM_MUSIC;
    }

    return aps->getOutput(stream, samplingRate, format, channelMask, flags, offloadInfo);
}

+12 −0
Original line number Diff line number Diff line
@@ -328,6 +328,12 @@ int JetPlayer::loadFromFile(const char* path)
    Mutex::Autolock lock(mMutex);

    mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE));
    if (mEasJetFileLoc == NULL) {
        ALOGE("Failed to allocate file locator object");
        mState = EAS_STATE_ERROR;
        return EAS_ERROR_MALLOC_FAILED;
    }

    strncpy(mJetFilePath, path, sizeof(mJetFilePath));
    mJetFilePath[sizeof(mJetFilePath) - 1] = '\0';
    mEasJetFileLoc->path = mJetFilePath;
@@ -353,6 +359,12 @@ int JetPlayer::loadFromFD(const int fd, const long long offset, const long long
    Mutex::Autolock lock(mMutex);

    mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE));
    if (mEasJetFileLoc == NULL) {
        ALOGE("Failed to allocate file locator object");
        mState = EAS_STATE_ERROR;
        return EAS_ERROR_MALLOC_FAILED;
    }

    mEasJetFileLoc->fd = fd;
    mEasJetFileLoc->offset = offset;
    mEasJetFileLoc->length = length;
+13 −1
Original line number Diff line number Diff line
@@ -3423,8 +3423,20 @@ bool AwesomePlayer::isWidevineContent() const {

status_t AwesomePlayer::dump(int fd, const Vector<String16> &args) const {
    Mutex::Autolock autoLock(mStatsLock);
    int dfd = dup(fd);

    FILE *out = fdopen(dup(fd), "w");
    if (dfd < 0) {
        ALOGE("dump: failed to dup file descriptor");
        return -errno;
    }

    FILE *out = fdopen(dfd, "w");

    if (!out) {
        ALOGE("dump: failed to open file");
        close(dfd);
        return -ENOMEM;
    }

    fprintf(out, " AwesomePlayer\n");
    if (mStats.mFd < 0) {
+1 −1
Original line number Diff line number Diff line
@@ -625,7 +625,7 @@ bool ExtendedCodec::checkDPFromCodecSpecificData(const uint8_t *data, size_t siz
    const char startCode[]="\x00\x00\x01";
    size_t maxHeaderSize = 28;

    if (!data && (((size < 4) || (size > maxHeaderSize)))) {
    if (!data || (((size < 4) || (size > maxHeaderSize)))) {
        return retVal;
    }

Loading