OSDN Git Service

Fix log spam: Failed to open libwvm.so
authorGlenn Kasten <gkasten@google.com>
Fri, 12 Oct 2012 22:59:28 +0000 (15:59 -0700)
committerGlenn Kasten <gkasten@google.com>
Fri, 12 Oct 2012 23:00:50 +0000 (16:00 -0700)
Bug: 7342813
Change-Id: I98852f036e4679a653723fc2bf1435d6e9d7d34c

media/libstagefright/WVMExtractor.cpp

index 31b2bcf..5ae80cc 100644 (file)
@@ -72,15 +72,18 @@ WVMExtractor::WVMExtractor(const sp<DataSource> &source)
     }
 }
 
-bool WVMExtractor::getVendorLibHandle()
+static void init_routine()
 {
-    if (gVendorLibHandle == NULL) {
-        gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
-    }
-
+    gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
     if (gVendorLibHandle == NULL) {
         ALOGE("Failed to open libwvm.so");
     }
+}
+
+bool WVMExtractor::getVendorLibHandle()
+{
+    static pthread_once_t sOnceControl = PTHREAD_ONCE_INIT;
+    pthread_once(&sOnceControl, init_routine);
 
     return gVendorLibHandle != NULL;
 }