diff options
author | Wu-cheng Li <wuchengli@google.com> | 2012-03-14 17:25:57 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2012-03-19 13:54:15 +0800 |
commit | 8e0792bb55a604ffcd4aa90fdb4419d8b3c6ad24 (patch) | |
tree | 941e6c4f15c24ce375ab3f4a191bbbc2a438c12f /media/libstagefright | |
parent | d64f3a376536a993fe6d81730b8b7b738500435e (diff) | |
download | frameworks_av-8e0792bb55a604ffcd4aa90fdb4419d8b3c6ad24.zip frameworks_av-8e0792bb55a604ffcd4aa90fdb4419d8b3c6ad24.tar.gz frameworks_av-8e0792bb55a604ffcd4aa90fdb4419d8b3c6ad24.tar.bz2 |
Do not set camera preview display if the surface is null.
MediaRecorder.setPreviewDisplay() is not required if applications
use MediaRecorder.setCamera(). Besides, this causes a problem when
apps use Camera.setPreviewTexture. Camera service thinks the
surface texture from Camera.setPreviewTexture and the surface from
MediaRecorder.setPreviewDisplay are different.
bug:5988937
Change-Id: Ia345705b6679ef349db6e354feaa3cc0fe8bcd8c
Diffstat (limited to 'media/libstagefright')
-rwxr-xr-x | media/libstagefright/CameraSource.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index 2df5528..3ddad93 100755 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -515,9 +515,13 @@ status_t CameraSource::initWithCameraAccess( return err; } - // This CHECK is good, since we just passed the lock/unlock - // check earlier by calling mCamera->setParameters(). - CHECK_EQ((status_t)OK, mCamera->setPreviewDisplay(mSurface)); + // Set the preview display. Skip this if mSurface is null because + // applications may already set a surface to the camera. + if (mSurface != NULL) { + // This CHECK is good, since we just passed the lock/unlock + // check earlier by calling mCamera->setParameters(). + CHECK_EQ((status_t)OK, mCamera->setPreviewDisplay(mSurface)); + } // By default, do not store metadata in video buffers mIsMetaDataStoredInVideoBuffers = false; |