summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/WVMExtractor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/libstagefright/WVMExtractor.cpp')
-rw-r--r--media/libstagefright/WVMExtractor.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/media/libstagefright/WVMExtractor.cpp b/media/libstagefright/WVMExtractor.cpp
index 08d2ae2..5ae80cc 100644
--- a/media/libstagefright/WVMExtractor.cpp
+++ b/media/libstagefright/WVMExtractor.cpp
@@ -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;
}
@@ -121,6 +124,15 @@ int64_t WVMExtractor::getCachedDurationUs(status_t *finalStatus) {
return mImpl->getCachedDurationUs(finalStatus);
}
+status_t WVMExtractor::getEstimatedBandwidthKbps(int32_t *kbps) {
+ if (mImpl == NULL) {
+ return UNKNOWN_ERROR;
+ }
+
+ return mImpl->getEstimatedBandwidthKbps(kbps);
+}
+
+
void WVMExtractor::setAdaptiveStreamingMode(bool adaptive) {
if (mImpl != NULL) {
mImpl->setAdaptiveStreamingMode(adaptive);
@@ -139,6 +151,20 @@ void WVMExtractor::setUID(uid_t uid) {
}
}
+status_t WVMExtractor::getError() {
+ if (mImpl == NULL) {
+ return UNKNOWN_ERROR;
+ }
+
+ return mImpl->getError();
+}
+
+void WVMExtractor::setError(status_t err) {
+ if (mImpl != NULL) {
+ mImpl->setError(err);
+ }
+}
+
bool SniffWVM(
const sp<DataSource> &source, String8 *mimeType, float *confidence,
sp<AMessage> *) {