summaryrefslogtreecommitdiff
authorjunliang.zhou <junliang.zhou@amlogic.com>2012-04-12 08:34:55 (GMT)
committer junliang.zhou <junliang.zhou@amlogic.com>2012-04-12 08:34:55 (GMT)
commit242be50bd9deac5f483d6126c101d4795a131686 (patch)
treeb663169e0d10bb96d43c3591a27167afa7da84fd
parente9e759584f2cb4ae43b5e7518ebd1991edd69790 (diff)
downloadcamera-242be50bd9deac5f483d6126c101d4795a131686.zip
camera-242be50bd9deac5f483d6126c101d4795a131686.tar.gz
camera-242be50bd9deac5f483d6126c101d4795a131686.tar.bz2
decrease usb camera frame rate for improve performance, let audio run smooth
Diffstat
-rwxr-xr-xAndroid.mk4
-rwxr-xr-xV4LCameraAdapter/V4LCameraAdapter.cpp8
2 files changed, 11 insertions, 1 deletions
diff --git a/Android.mk b/Android.mk
index f109064..1bfbb3b 100755
--- a/Android.mk
+++ b/Android.mk
@@ -73,6 +73,10 @@ endif
ifeq ($(BOARD_USE_USB_CAMERA),true)
LOCAL_CFLAGS += -DAMLOGIC_USB_CAMERA_SUPPORT
+#descrease the number of camera captrue frames,and let skype run smoothly
+ifeq ($(BOARD_USB_CAMREA_DECREASE_FRAMES), true)
+ LOCAL_CFLAGS += -DAMLOGIC_USB_CAMERA_DECREASE_FRAMES
+endif
else
ifeq ($(BOARD_HAVE_MULTI_CAMERAS),true)
LOCAL_CFLAGS += -DAMLOGIC_MULTI_CAMERA_SUPPORT
diff --git a/V4LCameraAdapter/V4LCameraAdapter.cpp b/V4LCameraAdapter/V4LCameraAdapter.cpp
index 1a34aef..c30c5e1 100755
--- a/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -994,7 +994,13 @@ int V4LCameraAdapter::previewThread()
usleep(delay);
return BAD_VALUE;
}
-
+
+#ifdef AMLOGIC_USB_CAMERA_DECREASE_FRAMES
+ int previewFrameRate = mParams.getPreviewFrameRate();
+ int delay = (int)(1000000.0f / float(previewFrameRate)) >> 1;
+ usleep(delay*5);
+#endif
+
uint8_t* ptr = (uint8_t*) mPreviewBufs.keyAt(mPreviewIdxs.valueFor(index));
if (!ptr)