Loading media/libstagefright/AwesomePlayer.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,8 @@ #include "QCMetaData.h" #include "QCMetaData.h" #endif #endif #include "include/ExtendedUtils.h" #define USE_SURFACE_ALLOC 1 #define USE_SURFACE_ALLOC 1 #define FRAME_DROP_FREQ 0 #define FRAME_DROP_FREQ 0 Loading Loading @@ -2513,6 +2515,17 @@ status_t AwesomePlayer::finishSetDataSource_l() { &mUriHeaders, &cacheConfig, &disconnectAtHighwatermark); &mUriHeaders, &cacheConfig, &disconnectAtHighwatermark); mLock.unlock(); mLock.unlock(); int32_t port = 0; if (ExtendedUtils::ShellProp::getSTAProxyConfig(port)) { String8 portString = String8("127.0.0.1"); portString.appendFormat(":%d", port); ALOGI("getSTAProxyConfig Proxy IPportString %s", portString.string()); mUriHeaders.add(String8("use-proxy"), portString); } else { ALOGV("getSTAProxyConfig failed or disabled"); } status_t err = mConnectingDataSource->connect(mUri, &mUriHeaders); status_t err = mConnectingDataSource->connect(mUri, &mUriHeaders); // force connection at this point, to avoid a race condition between getMIMEType and the // force connection at this point, to avoid a race condition between getMIMEType and the // caching datasource constructed below, which could result in multiple requests to the // caching datasource constructed below, which could result in multiple requests to the Loading media/libstagefright/ExtendedUtils.cpp +47 −0 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <sys/types.h> #include <sys/types.h> #include <ctype.h> #include <ctype.h> #include <unistd.h> #include <unistd.h> #include <dlfcn.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/foundation/ABitReader.h> #include <media/stagefright/foundation/ABitReader.h> Loading Loading @@ -827,6 +828,48 @@ void ExtendedUtils::ShellProp::getRtpPortRange(unsigned *start, unsigned *end) { ALOGV("rtp port_start = %u, port_end = %u", *start, *end); ALOGV("rtp port_start = %u, port_end = %u", *start, *end); } } bool ExtendedUtils::ShellProp::getSTAProxyConfig(int32_t &port) { void* staLibHandle = NULL; char value[PROPERTY_VALUE_MAX]; property_get("persist.mm.sta.disable", value, "0"); // Return false if persist.disable.staproxy is set to 1 if (atoi(value)) { ALOGW("Proxy is disabled using persist.disable.staproxy"); return false; } staLibHandle = dlopen("libstaapi.so", RTLD_NOW); if (staLibHandle == NULL) { ALOGW("libstaapi.so open dll error :%s", dlerror()); return false; } typedef bool (*fnIsProxySupported)(); typedef int (*fnGetPort)(); fnIsProxySupported isProxySupported = (fnIsProxySupported) dlsym(staLibHandle, "isSTAProxySupported"); if (isProxySupported == NULL) { ALOGW("Not able to load the symbol"); return false; } if (isProxySupported()) { fnGetPort getPort = (fnGetPort)dlsym(staLibHandle, "getSTAProxyAlwaysAccelerateServicePort"); if (getPort == NULL) { ALOGW("Not able to load the symbol to get the STA proxy port"); return false; } port = getPort(); ALOGI("The STA proxy is running at port:%d", port ); } else { ALOGW("STA Proxy is not supported"); return false; } if (staLibHandle != NULL) { dlclose(staLibHandle); } return true; } void ExtendedUtils::setBFrames( void ExtendedUtils::setBFrames( OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { //ignore non QC components //ignore non QC components Loading Loading @@ -1702,6 +1745,10 @@ void ExtendedUtils::ShellProp::getRtpPortRange(unsigned *start, unsigned *end) { *end = kDefaultRtpPortRangeEnd; *end = kDefaultRtpPortRangeEnd; } } bool ExtendedUtils::ShellProp::getSTAProxyConfig(int32_t &port) { return false; } void ExtendedUtils::setBFrames( void ExtendedUtils::setBFrames( OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { ARG_TOUCH(mpeg4type); ARG_TOUCH(mpeg4type); Loading media/libstagefright/include/ExtendedUtils.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -167,6 +167,8 @@ struct ExtendedUtils { //helper function to parse rtp port range form system property //helper function to parse rtp port range form system property static void getRtpPortRange(unsigned *start, unsigned *end); static void getRtpPortRange(unsigned *start, unsigned *end); static bool getSTAProxyConfig(int32_t &port); }; }; struct RTSPStream { struct RTSPStream { Loading Loading @@ -201,7 +203,6 @@ struct ExtendedUtils { static const int32_t kNumBFramesPerPFrame = 1; static const int32_t kNumBFramesPerPFrame = 1; static bool mIsQCHWAACEncoder; static bool mIsQCHWAACEncoder; //set B frames for MPEG4 //set B frames for MPEG4 static void setBFrames(OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, static void setBFrames(OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName); const char* componentName); Loading Loading
media/libstagefright/AwesomePlayer.cpp +13 −0 Original line number Original line Diff line number Diff line Loading @@ -68,6 +68,8 @@ #include "QCMetaData.h" #include "QCMetaData.h" #endif #endif #include "include/ExtendedUtils.h" #define USE_SURFACE_ALLOC 1 #define USE_SURFACE_ALLOC 1 #define FRAME_DROP_FREQ 0 #define FRAME_DROP_FREQ 0 Loading Loading @@ -2513,6 +2515,17 @@ status_t AwesomePlayer::finishSetDataSource_l() { &mUriHeaders, &cacheConfig, &disconnectAtHighwatermark); &mUriHeaders, &cacheConfig, &disconnectAtHighwatermark); mLock.unlock(); mLock.unlock(); int32_t port = 0; if (ExtendedUtils::ShellProp::getSTAProxyConfig(port)) { String8 portString = String8("127.0.0.1"); portString.appendFormat(":%d", port); ALOGI("getSTAProxyConfig Proxy IPportString %s", portString.string()); mUriHeaders.add(String8("use-proxy"), portString); } else { ALOGV("getSTAProxyConfig failed or disabled"); } status_t err = mConnectingDataSource->connect(mUri, &mUriHeaders); status_t err = mConnectingDataSource->connect(mUri, &mUriHeaders); // force connection at this point, to avoid a race condition between getMIMEType and the // force connection at this point, to avoid a race condition between getMIMEType and the // caching datasource constructed below, which could result in multiple requests to the // caching datasource constructed below, which could result in multiple requests to the Loading
media/libstagefright/ExtendedUtils.cpp +47 −0 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <sys/types.h> #include <sys/types.h> #include <ctype.h> #include <ctype.h> #include <unistd.h> #include <unistd.h> #include <dlfcn.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/MetaData.h> #include <media/stagefright/foundation/ABitReader.h> #include <media/stagefright/foundation/ABitReader.h> Loading Loading @@ -827,6 +828,48 @@ void ExtendedUtils::ShellProp::getRtpPortRange(unsigned *start, unsigned *end) { ALOGV("rtp port_start = %u, port_end = %u", *start, *end); ALOGV("rtp port_start = %u, port_end = %u", *start, *end); } } bool ExtendedUtils::ShellProp::getSTAProxyConfig(int32_t &port) { void* staLibHandle = NULL; char value[PROPERTY_VALUE_MAX]; property_get("persist.mm.sta.disable", value, "0"); // Return false if persist.disable.staproxy is set to 1 if (atoi(value)) { ALOGW("Proxy is disabled using persist.disable.staproxy"); return false; } staLibHandle = dlopen("libstaapi.so", RTLD_NOW); if (staLibHandle == NULL) { ALOGW("libstaapi.so open dll error :%s", dlerror()); return false; } typedef bool (*fnIsProxySupported)(); typedef int (*fnGetPort)(); fnIsProxySupported isProxySupported = (fnIsProxySupported) dlsym(staLibHandle, "isSTAProxySupported"); if (isProxySupported == NULL) { ALOGW("Not able to load the symbol"); return false; } if (isProxySupported()) { fnGetPort getPort = (fnGetPort)dlsym(staLibHandle, "getSTAProxyAlwaysAccelerateServicePort"); if (getPort == NULL) { ALOGW("Not able to load the symbol to get the STA proxy port"); return false; } port = getPort(); ALOGI("The STA proxy is running at port:%d", port ); } else { ALOGW("STA Proxy is not supported"); return false; } if (staLibHandle != NULL) { dlclose(staLibHandle); } return true; } void ExtendedUtils::setBFrames( void ExtendedUtils::setBFrames( OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { //ignore non QC components //ignore non QC components Loading Loading @@ -1702,6 +1745,10 @@ void ExtendedUtils::ShellProp::getRtpPortRange(unsigned *start, unsigned *end) { *end = kDefaultRtpPortRangeEnd; *end = kDefaultRtpPortRangeEnd; } } bool ExtendedUtils::ShellProp::getSTAProxyConfig(int32_t &port) { return false; } void ExtendedUtils::setBFrames( void ExtendedUtils::setBFrames( OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName) { ARG_TOUCH(mpeg4type); ARG_TOUCH(mpeg4type); Loading
media/libstagefright/include/ExtendedUtils.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -167,6 +167,8 @@ struct ExtendedUtils { //helper function to parse rtp port range form system property //helper function to parse rtp port range form system property static void getRtpPortRange(unsigned *start, unsigned *end); static void getRtpPortRange(unsigned *start, unsigned *end); static bool getSTAProxyConfig(int32_t &port); }; }; struct RTSPStream { struct RTSPStream { Loading Loading @@ -201,7 +203,6 @@ struct ExtendedUtils { static const int32_t kNumBFramesPerPFrame = 1; static const int32_t kNumBFramesPerPFrame = 1; static bool mIsQCHWAACEncoder; static bool mIsQCHWAACEncoder; //set B frames for MPEG4 //set B frames for MPEG4 static void setBFrames(OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, static void setBFrames(OMX_VIDEO_PARAM_MPEG4TYPE &mpeg4type, const char* componentName); const char* componentName); Loading