43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#include <gui/mediatek/BBQDispDeJitterHelper.h>
|
|
|
|
#include <dlfcn.h>
|
|
#include <cutils/log.h>
|
|
|
|
namespace android {
|
|
|
|
BBQDispDeJitterHelper& BBQDispDeJitterHelper::getInstance() {
|
|
static BBQDispDeJitterHelper gInstance;
|
|
return gInstance;
|
|
}
|
|
|
|
BBQDispDeJitterHelper::BBQDispDeJitterHelper()
|
|
: mSoHandle(nullptr),
|
|
mFnMarkTimestamp(nullptr) {
|
|
typedef void (*MarkTimestamp)(const sp<GraphicBuffer>&, const uint64_t);
|
|
|
|
// dlopen must set RTLD_LAZY flag because of performance issue
|
|
mSoHandle = dlopen("libdisp_dejitter.so", RTLD_LAZY);
|
|
if (mSoHandle) {
|
|
mFnMarkTimestamp = reinterpret_cast<MarkTimestamp>(dlsym(mSoHandle, "markTimestamp"));
|
|
if (nullptr == mFnMarkTimestamp) {
|
|
ALOGE("finding markTimestamp() failed");
|
|
}
|
|
} else {
|
|
ALOGE("open libdisp_dejitter failed");
|
|
}
|
|
}
|
|
|
|
BBQDispDeJitterHelper::~BBQDispDeJitterHelper() {
|
|
if (mSoHandle) {
|
|
dlclose(mSoHandle);
|
|
}
|
|
}
|
|
|
|
void BBQDispDeJitterHelper::markTimestamp(const sp<GraphicBuffer>& gb, const uint64_t q_time) {
|
|
if (mFnMarkTimestamp) {
|
|
mFnMarkTimestamp(gb, q_time);
|
|
}
|
|
}
|
|
|
|
} // namespace android
|