void profileCodecs(const Vector<sp<MediaCodecInfo>> &infos) {
    CodecSettings global_results;
    KeyedVector<AString, CodecSettings> encoder_results;
    KeyedVector<AString, CodecSettings> decoder_results;
    profileCodecs(infos, &global_results, &encoder_results, &decoder_results);
    exportResultsToXML(kProfilingResults, global_results, encoder_results, decoder_results);
}
// static
void *MediaCodecList::profilerThreadWrapper(void * /*arg*/) {
    ALOGV("Enter profilerThreadWrapper.");
    remove(kProfilingResults);  // remove previous result so that it won't be loaded to
                                // the new MediaCodecList
    MediaCodecList *codecList = new MediaCodecList();
    if (codecList->initCheck() != OK) {
        ALOGW("Failed to create a new MediaCodecList, skipping codec profiling.");
        delete codecList;
        return NULL;
    }

    Vector<sp<MediaCodecInfo>> infos;
    for (size_t i = 0; i < codecList->countCodecs(); ++i) {
        infos.push_back(codecList->getCodecInfo(i));
    }
    ALOGV("Codec profiling started.");
    profileCodecs(infos);
    ALOGV("Codec profiling completed.");
    codecList->parseTopLevelXMLFile(kProfilingResults, true /* ignore_errors */);

    {
        Mutex::Autolock autoLock(sInitMutex);
        sCodecList = codecList;
    }
    return NULL;
}