Loading media/libstagefright/MediaCodecList.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -354,8 +354,19 @@ void MediaCodecList::findMatchingCodecs( //static void MediaCodecList::findMatchingCodecs( const char *mime, bool encoder, uint32_t flags, sp<AMessage> format, const char *mime, bool encoder, uint32_t flags, const sp<AMessage> &format, Vector<AString> *matches) { findMatchingCodecs(mime, encoder, flags, format, matches, /* checkProfile= */ true); if (matches->empty()) { ALOGV("no matching codec found, retrying without profile check"); findMatchingCodecs(mime, encoder, flags, format, matches, /* checkProfile= */ false); } } //static void MediaCodecList::findMatchingCodecs( const char *mime, bool encoder, uint32_t flags, const sp<AMessage> &format, Vector<AString> *matches, bool checkProfile) { matches->clear(); const sp<IMediaCodecList> list = getInstance(); Loading @@ -379,7 +390,7 @@ void MediaCodecList::findMatchingCodecs( AString componentName = info->getCodecName(); if (!codecHandlesFormat(mime, info, format)) { if (!codecHandlesFormat(mime, info, format, checkProfile)) { ALOGV("skipping codec '%s' which doesn't satisfy format %s", componentName.c_str(), format->debugString(2).c_str()); continue; Loading @@ -400,9 +411,10 @@ void MediaCodecList::findMatchingCodecs( } } /*static*/ bool MediaCodecList::codecHandlesFormat(const char *mime, sp<MediaCodecInfo> info, sp<AMessage> format) { // static bool MediaCodecList::codecHandlesFormat( const char *mime, const sp<MediaCodecInfo> &info, const sp<AMessage> &format, bool checkProfile) { if (format == nullptr) { ALOGD("codecHandlesFormat: no format, so no extra checks"); Loading Loading @@ -510,7 +522,7 @@ bool MediaCodecList::codecHandlesFormat(const char *mime, sp<MediaCodecInfo> inf } int32_t profile = -1; if (format->findInt32("profile", &profile)) { if (checkProfile && format->findInt32("profile", &profile)) { Vector<MediaCodecInfo::ProfileLevel> profileLevels; capabilities->getSupportedProfileLevels(&profileLevels); auto it = profileLevels.begin(); Loading media/libstagefright/include/media/stagefright/MediaCodecList.h +15 −3 Original line number Diff line number Diff line Loading @@ -80,11 +80,9 @@ struct MediaCodecList : public BnMediaCodecList { const char *mime, bool createEncoder, uint32_t flags, sp<AMessage> format, const sp<AMessage> &format, Vector<AString> *matchingCodecs); static bool codecHandlesFormat(const char *mime, sp<MediaCodecInfo> info, sp<AMessage> format); static bool isSoftwareCodec(const AString &componentName); private: Loading Loading @@ -115,6 +113,20 @@ private: MediaCodecList(const MediaCodecList&) = delete; MediaCodecList& operator=(const MediaCodecList&) = delete; static void findMatchingCodecs( const char *mime, bool createEncoder, uint32_t flags, const sp<AMessage> &format, Vector<AString> *matchingCodecs, bool checkProfile); static bool codecHandlesFormat( const char *mime, const sp<MediaCodecInfo> &info, const sp<AMessage> &format, bool checkProfile); }; } // namespace android Loading Loading
media/libstagefright/MediaCodecList.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -354,8 +354,19 @@ void MediaCodecList::findMatchingCodecs( //static void MediaCodecList::findMatchingCodecs( const char *mime, bool encoder, uint32_t flags, sp<AMessage> format, const char *mime, bool encoder, uint32_t flags, const sp<AMessage> &format, Vector<AString> *matches) { findMatchingCodecs(mime, encoder, flags, format, matches, /* checkProfile= */ true); if (matches->empty()) { ALOGV("no matching codec found, retrying without profile check"); findMatchingCodecs(mime, encoder, flags, format, matches, /* checkProfile= */ false); } } //static void MediaCodecList::findMatchingCodecs( const char *mime, bool encoder, uint32_t flags, const sp<AMessage> &format, Vector<AString> *matches, bool checkProfile) { matches->clear(); const sp<IMediaCodecList> list = getInstance(); Loading @@ -379,7 +390,7 @@ void MediaCodecList::findMatchingCodecs( AString componentName = info->getCodecName(); if (!codecHandlesFormat(mime, info, format)) { if (!codecHandlesFormat(mime, info, format, checkProfile)) { ALOGV("skipping codec '%s' which doesn't satisfy format %s", componentName.c_str(), format->debugString(2).c_str()); continue; Loading @@ -400,9 +411,10 @@ void MediaCodecList::findMatchingCodecs( } } /*static*/ bool MediaCodecList::codecHandlesFormat(const char *mime, sp<MediaCodecInfo> info, sp<AMessage> format) { // static bool MediaCodecList::codecHandlesFormat( const char *mime, const sp<MediaCodecInfo> &info, const sp<AMessage> &format, bool checkProfile) { if (format == nullptr) { ALOGD("codecHandlesFormat: no format, so no extra checks"); Loading Loading @@ -510,7 +522,7 @@ bool MediaCodecList::codecHandlesFormat(const char *mime, sp<MediaCodecInfo> inf } int32_t profile = -1; if (format->findInt32("profile", &profile)) { if (checkProfile && format->findInt32("profile", &profile)) { Vector<MediaCodecInfo::ProfileLevel> profileLevels; capabilities->getSupportedProfileLevels(&profileLevels); auto it = profileLevels.begin(); Loading
media/libstagefright/include/media/stagefright/MediaCodecList.h +15 −3 Original line number Diff line number Diff line Loading @@ -80,11 +80,9 @@ struct MediaCodecList : public BnMediaCodecList { const char *mime, bool createEncoder, uint32_t flags, sp<AMessage> format, const sp<AMessage> &format, Vector<AString> *matchingCodecs); static bool codecHandlesFormat(const char *mime, sp<MediaCodecInfo> info, sp<AMessage> format); static bool isSoftwareCodec(const AString &componentName); private: Loading Loading @@ -115,6 +113,20 @@ private: MediaCodecList(const MediaCodecList&) = delete; MediaCodecList& operator=(const MediaCodecList&) = delete; static void findMatchingCodecs( const char *mime, bool createEncoder, uint32_t flags, const sp<AMessage> &format, Vector<AString> *matchingCodecs, bool checkProfile); static bool codecHandlesFormat( const char *mime, const sp<MediaCodecInfo> &info, const sp<AMessage> &format, bool checkProfile); }; } // namespace android Loading