summaryrefslogtreecommitdiff
authorVinson Xu <binsheng.xu@amlogic.com>2014-05-21 08:15:56 (GMT)
committer Sandy lUo <sandy.luo@amlogic.com>2014-09-19 08:41:37 (GMT)
commite24c16f49bc1240638780e254fcecf2e96098d68 (patch)
tree0f69e695b12f796025eb17852e570c0ca7b745c9
parent8c533254831f51de0944c54314d8a2a236717cb4 (diff)
downloadscreen_source-e24c16f49bc1240638780e254fcecf2e96098d68.zip
screen_source-e24c16f49bc1240638780e254fcecf2e96098d68.tar.gz
screen_source-e24c16f49bc1240638780e254fcecf2e96098d68.tar.bz2
PD #83054 fix crash bug because of opening video device failed
Conflicts: aml_screen.cpp v4l2_vdin.cpp Change-Id: I05fb46bc711e23cb9301e79c7b3625ee84168161
Diffstat
-rwxr-xr-xaml_screen.cpp8
-rwxr-xr-xv4l2_vdin.cpp3
-rwxr-xr-xv4l2_vdin.h2
3 files changed, 11 insertions, 2 deletions
diff --git a/aml_screen.cpp b/aml_screen.cpp
index 8e0921b..48acbd6 100755
--- a/aml_screen.cpp
+++ b/aml_screen.cpp
@@ -102,7 +102,6 @@ static int aml_screen_device_close(struct hw_device_t *dev)
int screen_source_start(struct aml_screen_device* dev)
{
android::vdin_screen_source* source = (android::vdin_screen_source*)dev->priv;
- LOGV("screen_source_start");
return source->start();
}
int screen_source_stop(struct aml_screen_device* dev)
@@ -237,6 +236,13 @@ static int aml_screen_device_open(const struct hw_module_t* module, const char*
free (dev);
return -ENOMEM;
}
+
+ if(source->init()!=0){
+ LOGE("open vdin_screen_source failed!");
+ free (dev);
+ return -1;
+ }
+
dev->priv = (void*)source;
/* initialize the procs */
diff --git a/v4l2_vdin.cpp b/v4l2_vdin.cpp
index 393e123..007373d 100755
--- a/v4l2_vdin.cpp
+++ b/v4l2_vdin.cpp
@@ -125,10 +125,13 @@ vdin_screen_source::vdin_screen_source()
mCameraHandle = open("/dev/video11", O_RDWR| O_NONBLOCK);
if (mCameraHandle < 0){
ALOGE("[%s %d] mCameraHandle:%x", __FUNCTION__, __LINE__, mCameraHandle);
+ return -1;
}
mVideoInfo = (struct VideoInfo *) calloc (1, sizeof (struct VideoInfo));
if (mVideoInfo == NULL){
ALOGE("[%s %d] no memory for mVideoInfo", __FUNCTION__, __LINE__);
+ close(mCameraHandle);
+ return NO_MEMORY;
}
mBufferCount = 4;
mPixelFormat = V4L2_PIX_FMT_NV21;
diff --git a/v4l2_vdin.h b/v4l2_vdin.h
index 19f2ea0..04dd34f 100755
--- a/v4l2_vdin.h
+++ b/v4l2_vdin.h
@@ -77,7 +77,7 @@ class vdin_screen_source {
public:
vdin_screen_source();
~vdin_screen_source();
-
+ int init();
int start();
int stop();
int pause();