Android 5.0 Source code learning (media)

来源:互联网 发布:软件项目合同书 编辑:程序博客网 时间:2024/06/05 04:15

Nuplayer

bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {

......

    for (size_t matchIndex = 0; matchIndex < matchingCodecs.size();
            ++matchIndex) {
        componentName = matchingCodecs.itemAt(matchIndex).mName.string();
        quirks = matchingCodecs.itemAt(matchIndex).mQuirks;

        pid_t tid = androidGetTid();
        int prevPriority = androidGetThreadPriority(tid);
        androidSetThreadPriority(tid, ANDROID_PRIORITY_FOREGROUND);
        status_t err = omx->allocateNode(componentName.c_str(), observer, &node);
        androidSetThreadPriority(tid, prevPriority);

        if (err == OK) {//Get codecs by index in media_codecs.xml
            break;

        } else {
            ALOGW("Allocating component '%s' failed, try next one.", componentName.c_str());
        }

        node = NULL;
    }

......

}

0 0
原创粉丝点击