Loading camera/device/3.4/default/ExternalCameraDevice.cpp +9 −3 Original line number Diff line number Diff line Loading @@ -793,7 +793,8 @@ void ExternalCameraDevice::trimSupportedFormats( std::vector<SupportedV4L2Format> ExternalCameraDevice::getCandidateSupportedFormatsLocked( int fd, CroppingType cropType, const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits) { const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits, const Size& minStreamSize) { std::vector<SupportedV4L2Format> outFmts; struct v4l2_fmtdesc fmtdesc { .index = 0, Loading Loading @@ -828,6 +829,11 @@ ExternalCameraDevice::getCandidateSupportedFormatsLocked( if (frameSize.discrete.height > frameSize.discrete.width) { continue; } // Discard all formats which is smaller than minStreamSize if (frameSize.discrete.width < minStreamSize.width || frameSize.discrete.height < minStreamSize.height) { continue; } SupportedV4L2Format format { .width = frameSize.discrete.width, .height = frameSize.discrete.height, Loading Loading @@ -870,9 +876,9 @@ ExternalCameraDevice::getCandidateSupportedFormatsLocked( void ExternalCameraDevice::initSupportedFormatsLocked(int fd) { std::vector<SupportedV4L2Format> horizontalFmts = getCandidateSupportedFormatsLocked(fd, HORIZONTAL, mCfg.fpsLimits); getCandidateSupportedFormatsLocked(fd, HORIZONTAL, mCfg.fpsLimits, mCfg.minStreamSize); std::vector<SupportedV4L2Format> verticalFmts = getCandidateSupportedFormatsLocked(fd, VERTICAL, mCfg.fpsLimits); getCandidateSupportedFormatsLocked(fd, VERTICAL, mCfg.fpsLimits, mCfg.minStreamSize); size_t horiSize = horizontalFmts.size(); size_t vertSize = verticalFmts.size(); Loading camera/device/3.4/default/ExternalCameraUtils.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,15 @@ ExternalCameraConfig ExternalCameraConfig::loadFromCfg(const char* cfgPath) { ret.fpsLimits = limits; } XMLElement *minStreamSize = deviceCfg->FirstChildElement("MinimumStreamSize"); if (minStreamSize == nullptr) { ALOGI("%s: no minimum stream size specified", __FUNCTION__); } else { ret.minStreamSize = { minStreamSize->UnsignedAttribute("width", /*Default*/0), minStreamSize->UnsignedAttribute("height", /*Default*/0)}; } ALOGI("%s: external camera cfg loaded: maxJpgBufSize %d," " num video buffers %d, num still buffers %d", __FUNCTION__, ret.maxJpegBufSize, Loading @@ -275,6 +284,8 @@ ExternalCameraConfig ExternalCameraConfig::loadFromCfg(const char* cfgPath) { ALOGI("%s: fpsLimitList: %dx%d@%f", __FUNCTION__, limit.size.width, limit.size.height, limit.fpsUpperBound); } ALOGI("%s: minStreamSize: %dx%d" , __FUNCTION__, ret.minStreamSize.width, ret.minStreamSize.height); return ret; } Loading @@ -285,6 +296,7 @@ ExternalCameraConfig::ExternalCameraConfig() : fpsLimits.push_back({/*Size*/{ 640, 480}, /*FPS upper bound*/30.0}); fpsLimits.push_back({/*Size*/{1280, 720}, /*FPS upper bound*/7.5}); fpsLimits.push_back({/*Size*/{1920, 1080}, /*FPS upper bound*/5.0}); minStreamSize = {0, 0}; } Loading camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDevice_3_4.h +2 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,8 @@ protected: // Get candidate supported formats list of input cropping type. static std::vector<SupportedV4L2Format> getCandidateSupportedFormatsLocked( int fd, CroppingType cropType, const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits); const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits, const Size& minStreamSize); // Trim supported format list by the cropping type. Also sort output formats by width/height static void trimSupportedFormats(CroppingType cropType, /*inout*/std::vector<SupportedV4L2Format>* pFmts); Loading camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraUtils.h +3 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ struct ExternalCameraConfig { }; std::vector<FpsLimitation> fpsLimits; // Minimum output stream size Size minStreamSize; private: ExternalCameraConfig(); }; Loading Loading
camera/device/3.4/default/ExternalCameraDevice.cpp +9 −3 Original line number Diff line number Diff line Loading @@ -793,7 +793,8 @@ void ExternalCameraDevice::trimSupportedFormats( std::vector<SupportedV4L2Format> ExternalCameraDevice::getCandidateSupportedFormatsLocked( int fd, CroppingType cropType, const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits) { const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits, const Size& minStreamSize) { std::vector<SupportedV4L2Format> outFmts; struct v4l2_fmtdesc fmtdesc { .index = 0, Loading Loading @@ -828,6 +829,11 @@ ExternalCameraDevice::getCandidateSupportedFormatsLocked( if (frameSize.discrete.height > frameSize.discrete.width) { continue; } // Discard all formats which is smaller than minStreamSize if (frameSize.discrete.width < minStreamSize.width || frameSize.discrete.height < minStreamSize.height) { continue; } SupportedV4L2Format format { .width = frameSize.discrete.width, .height = frameSize.discrete.height, Loading Loading @@ -870,9 +876,9 @@ ExternalCameraDevice::getCandidateSupportedFormatsLocked( void ExternalCameraDevice::initSupportedFormatsLocked(int fd) { std::vector<SupportedV4L2Format> horizontalFmts = getCandidateSupportedFormatsLocked(fd, HORIZONTAL, mCfg.fpsLimits); getCandidateSupportedFormatsLocked(fd, HORIZONTAL, mCfg.fpsLimits, mCfg.minStreamSize); std::vector<SupportedV4L2Format> verticalFmts = getCandidateSupportedFormatsLocked(fd, VERTICAL, mCfg.fpsLimits); getCandidateSupportedFormatsLocked(fd, VERTICAL, mCfg.fpsLimits, mCfg.minStreamSize); size_t horiSize = horizontalFmts.size(); size_t vertSize = verticalFmts.size(); Loading
camera/device/3.4/default/ExternalCameraUtils.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -267,6 +267,15 @@ ExternalCameraConfig ExternalCameraConfig::loadFromCfg(const char* cfgPath) { ret.fpsLimits = limits; } XMLElement *minStreamSize = deviceCfg->FirstChildElement("MinimumStreamSize"); if (minStreamSize == nullptr) { ALOGI("%s: no minimum stream size specified", __FUNCTION__); } else { ret.minStreamSize = { minStreamSize->UnsignedAttribute("width", /*Default*/0), minStreamSize->UnsignedAttribute("height", /*Default*/0)}; } ALOGI("%s: external camera cfg loaded: maxJpgBufSize %d," " num video buffers %d, num still buffers %d", __FUNCTION__, ret.maxJpegBufSize, Loading @@ -275,6 +284,8 @@ ExternalCameraConfig ExternalCameraConfig::loadFromCfg(const char* cfgPath) { ALOGI("%s: fpsLimitList: %dx%d@%f", __FUNCTION__, limit.size.width, limit.size.height, limit.fpsUpperBound); } ALOGI("%s: minStreamSize: %dx%d" , __FUNCTION__, ret.minStreamSize.width, ret.minStreamSize.height); return ret; } Loading @@ -285,6 +296,7 @@ ExternalCameraConfig::ExternalCameraConfig() : fpsLimits.push_back({/*Size*/{ 640, 480}, /*FPS upper bound*/30.0}); fpsLimits.push_back({/*Size*/{1280, 720}, /*FPS upper bound*/7.5}); fpsLimits.push_back({/*Size*/{1920, 1080}, /*FPS upper bound*/5.0}); minStreamSize = {0, 0}; } Loading
camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDevice_3_4.h +2 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,8 @@ protected: // Get candidate supported formats list of input cropping type. static std::vector<SupportedV4L2Format> getCandidateSupportedFormatsLocked( int fd, CroppingType cropType, const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits); const std::vector<ExternalCameraConfig::FpsLimitation>& fpsLimits, const Size& minStreamSize); // Trim supported format list by the cropping type. Also sort output formats by width/height static void trimSupportedFormats(CroppingType cropType, /*inout*/std::vector<SupportedV4L2Format>* pFmts); Loading
camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraUtils.h +3 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,9 @@ struct ExternalCameraConfig { }; std::vector<FpsLimitation> fpsLimits; // Minimum output stream size Size minStreamSize; private: ExternalCameraConfig(); }; Loading