Loading media/codec2/vndk/C2Store.cpp +11 −18 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <C2Config.h> #include <C2PlatformStorePluginLoader.h> #include <C2PlatformSupport.h> #include <media/stagefright/foundation/ADebug.h> #include <util/C2InterfaceHelper.h> #include <dlfcn.h> Loading Loading @@ -662,36 +661,30 @@ c2_status_t C2PlatformComponentStore::ComponentModule::init( ALOGV("in %s", __func__); ALOGV("loading dll"); mLibHandle = dlopen(libPath.c_str(), RTLD_NOW|RTLD_NODELETE); if (mLibHandle == nullptr) { LOG_ALWAYS_FATAL_IN_CHILD_PROC("could not dlopen %s: %s", libPath.c_str(), dlerror()); mInit = C2_CORRUPTED; return mInit; } LOG_ALWAYS_FATAL_IF(mLibHandle == nullptr, "could not dlopen %s: %s", libPath.c_str(), dlerror()); createFactory = (C2ComponentFactory::CreateCodec2FactoryFunc)dlsym(mLibHandle, "CreateCodec2Factory"); if (createFactory == nullptr) { LOG_ALWAYS_FATAL_IN_CHILD_PROC("createFactory is null in %s", libPath.c_str()); mInit = C2_CORRUPTED; return mInit; } LOG_ALWAYS_FATAL_IF(createFactory == nullptr, "createFactory is null in %s", libPath.c_str()); destroyFactory = (C2ComponentFactory::DestroyCodec2FactoryFunc)dlsym(mLibHandle, "DestroyCodec2Factory"); if (destroyFactory == nullptr) { LOG_ALWAYS_FATAL_IN_CHILD_PROC("destroyFactory is null in %s", libPath.c_str()); mInit = C2_CORRUPTED; return mInit; } LOG_ALWAYS_FATAL_IF(destroyFactory == nullptr, "destroyFactory is null in %s", libPath.c_str()); mComponentFactory = createFactory(); if (mComponentFactory == nullptr) { ALOGD("could not create factory in %s", libPath.c_str()); mInit = C2_NO_MEMORY; return mInit; } else { mInit = C2_OK; } mInit = C2_OK; if (mInit != C2_OK) { return mInit; } std::shared_ptr<C2ComponentInterface> intf; c2_status_t res = createInterface(0, &intf); Loading media/libstagefright/MediaExtractorFactory.cpp +13 −19 Original line number Diff line number Diff line Loading @@ -19,11 +19,11 @@ #include <utils/Log.h> #include <android/dlext.h> #include <android-base/logging.h> #include <binder/IPCThreadState.h> #include <binder/PermissionCache.h> #include <binder/IServiceManager.h> #include <media/DataSource.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/InterfaceUtils.h> #include <media/stagefright/MediaExtractor.h> #include <media/stagefright/MediaExtractorFactory.h> Loading Loading @@ -71,8 +71,6 @@ sp<IMediaExtractor> MediaExtractorFactory::CreateFromService( ALOGV("MediaExtractorFactory::CreateFromService %s", mime); UpdateExtractors(); // initialize source decryption if needed source->DrmInitialization(nullptr /* mime */); Loading Loading @@ -245,21 +243,17 @@ void MediaExtractorFactory::RegisterExtractors( void *libHandle = android_dlopen_ext( libPath.string(), RTLD_NOW | RTLD_LOCAL, dlextinfo); if (libHandle) { CHECK(libHandle != nullptr) << "couldn't dlopen(" << libPath.string() << ") " << strerror(errno); GetExtractorDef getDef = (GetExtractorDef) dlsym(libHandle, "GETEXTRACTORDEF"); if (getDef) { CHECK(getDef != nullptr) << libPath.string() << " does not contain sniffer"; ALOGV("registering sniffer for %s", libPath.string()); RegisterExtractor( new ExtractorPlugin(getDef(), libHandle, libPath), pluginList); } else { LOG_ALWAYS_FATAL_IN_CHILD_PROC("%s does not contain sniffer", libPath.string()); dlclose(libHandle); } } else { LOG_ALWAYS_FATAL_IN_CHILD_PROC( "couldn't dlopen(%s) %s", libPath.string(), strerror(errno)); } } closedir(libDir); } else { Loading @@ -274,7 +268,7 @@ static bool compareFunc(const sp<ExtractorPlugin>& first, const sp<ExtractorPlug static std::unordered_set<std::string> gSupportedExtensions; // static void MediaExtractorFactory::UpdateExtractors() { void MediaExtractorFactory::LoadExtractors() { Mutex::Autolock autoLock(gPluginMutex); if (gPluginsRegistered) { Loading media/libstagefright/foundation/include/media/stagefright/foundation/ADebug.h +0 −9 Original line number Diff line number Diff line Loading @@ -114,15 +114,6 @@ inline static const char *asString(status_t i, const char *def = "??") { #define TRESPASS_DBG(...) #endif #ifndef LOG_ALWAYS_FATAL_IN_CHILD_PROC #define LOG_ALWAYS_FATAL_IN_CHILD_PROC(...) \ do { \ if (fork() == 0) { \ LOG_ALWAYS_FATAL(__VA_ARGS__); \ } \ } while (false) #endif struct ADebug { enum Level { kDebugNone, // no debug Loading media/libstagefright/include/media/stagefright/MediaExtractorFactory.h +1 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ public: const sp<DataSource> &source, const char *mime = NULL); static status_t dump(int fd, const Vector<String16>& args); static std::unordered_set<std::string> getSupportedTypes(); static void LoadExtractors(); private: static Mutex gPluginMutex; Loading @@ -53,8 +54,6 @@ private: static void *sniff(const sp<DataSource> &source, float *confidence, void **meta, FreeMetaFunc *freeMeta, sp<ExtractorPlugin> &plugin, uint32_t *creatorVersion); static void UpdateExtractors(); }; } // namespace android Loading services/mediaextractor/MediaExtractorService.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,9 @@ namespace android { MediaExtractorService::MediaExtractorService() : BnMediaExtractorService() { } : BnMediaExtractorService() { MediaExtractorFactory::LoadExtractors(); } sp<IMediaExtractor> MediaExtractorService::makeExtractor( const sp<IDataSource> &remoteSource, const char *mime) { Loading Loading
media/codec2/vndk/C2Store.cpp +11 −18 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <C2Config.h> #include <C2PlatformStorePluginLoader.h> #include <C2PlatformSupport.h> #include <media/stagefright/foundation/ADebug.h> #include <util/C2InterfaceHelper.h> #include <dlfcn.h> Loading Loading @@ -662,36 +661,30 @@ c2_status_t C2PlatformComponentStore::ComponentModule::init( ALOGV("in %s", __func__); ALOGV("loading dll"); mLibHandle = dlopen(libPath.c_str(), RTLD_NOW|RTLD_NODELETE); if (mLibHandle == nullptr) { LOG_ALWAYS_FATAL_IN_CHILD_PROC("could not dlopen %s: %s", libPath.c_str(), dlerror()); mInit = C2_CORRUPTED; return mInit; } LOG_ALWAYS_FATAL_IF(mLibHandle == nullptr, "could not dlopen %s: %s", libPath.c_str(), dlerror()); createFactory = (C2ComponentFactory::CreateCodec2FactoryFunc)dlsym(mLibHandle, "CreateCodec2Factory"); if (createFactory == nullptr) { LOG_ALWAYS_FATAL_IN_CHILD_PROC("createFactory is null in %s", libPath.c_str()); mInit = C2_CORRUPTED; return mInit; } LOG_ALWAYS_FATAL_IF(createFactory == nullptr, "createFactory is null in %s", libPath.c_str()); destroyFactory = (C2ComponentFactory::DestroyCodec2FactoryFunc)dlsym(mLibHandle, "DestroyCodec2Factory"); if (destroyFactory == nullptr) { LOG_ALWAYS_FATAL_IN_CHILD_PROC("destroyFactory is null in %s", libPath.c_str()); mInit = C2_CORRUPTED; return mInit; } LOG_ALWAYS_FATAL_IF(destroyFactory == nullptr, "destroyFactory is null in %s", libPath.c_str()); mComponentFactory = createFactory(); if (mComponentFactory == nullptr) { ALOGD("could not create factory in %s", libPath.c_str()); mInit = C2_NO_MEMORY; return mInit; } else { mInit = C2_OK; } mInit = C2_OK; if (mInit != C2_OK) { return mInit; } std::shared_ptr<C2ComponentInterface> intf; c2_status_t res = createInterface(0, &intf); Loading
media/libstagefright/MediaExtractorFactory.cpp +13 −19 Original line number Diff line number Diff line Loading @@ -19,11 +19,11 @@ #include <utils/Log.h> #include <android/dlext.h> #include <android-base/logging.h> #include <binder/IPCThreadState.h> #include <binder/PermissionCache.h> #include <binder/IServiceManager.h> #include <media/DataSource.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/InterfaceUtils.h> #include <media/stagefright/MediaExtractor.h> #include <media/stagefright/MediaExtractorFactory.h> Loading Loading @@ -71,8 +71,6 @@ sp<IMediaExtractor> MediaExtractorFactory::CreateFromService( ALOGV("MediaExtractorFactory::CreateFromService %s", mime); UpdateExtractors(); // initialize source decryption if needed source->DrmInitialization(nullptr /* mime */); Loading Loading @@ -245,21 +243,17 @@ void MediaExtractorFactory::RegisterExtractors( void *libHandle = android_dlopen_ext( libPath.string(), RTLD_NOW | RTLD_LOCAL, dlextinfo); if (libHandle) { CHECK(libHandle != nullptr) << "couldn't dlopen(" << libPath.string() << ") " << strerror(errno); GetExtractorDef getDef = (GetExtractorDef) dlsym(libHandle, "GETEXTRACTORDEF"); if (getDef) { CHECK(getDef != nullptr) << libPath.string() << " does not contain sniffer"; ALOGV("registering sniffer for %s", libPath.string()); RegisterExtractor( new ExtractorPlugin(getDef(), libHandle, libPath), pluginList); } else { LOG_ALWAYS_FATAL_IN_CHILD_PROC("%s does not contain sniffer", libPath.string()); dlclose(libHandle); } } else { LOG_ALWAYS_FATAL_IN_CHILD_PROC( "couldn't dlopen(%s) %s", libPath.string(), strerror(errno)); } } closedir(libDir); } else { Loading @@ -274,7 +268,7 @@ static bool compareFunc(const sp<ExtractorPlugin>& first, const sp<ExtractorPlug static std::unordered_set<std::string> gSupportedExtensions; // static void MediaExtractorFactory::UpdateExtractors() { void MediaExtractorFactory::LoadExtractors() { Mutex::Autolock autoLock(gPluginMutex); if (gPluginsRegistered) { Loading
media/libstagefright/foundation/include/media/stagefright/foundation/ADebug.h +0 −9 Original line number Diff line number Diff line Loading @@ -114,15 +114,6 @@ inline static const char *asString(status_t i, const char *def = "??") { #define TRESPASS_DBG(...) #endif #ifndef LOG_ALWAYS_FATAL_IN_CHILD_PROC #define LOG_ALWAYS_FATAL_IN_CHILD_PROC(...) \ do { \ if (fork() == 0) { \ LOG_ALWAYS_FATAL(__VA_ARGS__); \ } \ } while (false) #endif struct ADebug { enum Level { kDebugNone, // no debug Loading
media/libstagefright/include/media/stagefright/MediaExtractorFactory.h +1 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ public: const sp<DataSource> &source, const char *mime = NULL); static status_t dump(int fd, const Vector<String16>& args); static std::unordered_set<std::string> getSupportedTypes(); static void LoadExtractors(); private: static Mutex gPluginMutex; Loading @@ -53,8 +54,6 @@ private: static void *sniff(const sp<DataSource> &source, float *confidence, void **meta, FreeMetaFunc *freeMeta, sp<ExtractorPlugin> &plugin, uint32_t *creatorVersion); static void UpdateExtractors(); }; } // namespace android Loading
services/mediaextractor/MediaExtractorService.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,9 @@ namespace android { MediaExtractorService::MediaExtractorService() : BnMediaExtractorService() { } : BnMediaExtractorService() { MediaExtractorFactory::LoadExtractors(); } sp<IMediaExtractor> MediaExtractorService::makeExtractor( const sp<IDataSource> &remoteSource, const char *mime) { Loading