diff options
author | James Dong <jdong@google.com> | 2010-10-09 01:16:58 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-10-09 01:21:20 -0700 |
commit | 997eaa2c7c6f7c59d145dab3e93431ea2e2a7dc7 (patch) | |
tree | e2c981c36bfad2f95a0ab9f8be4b5ee8d3a4e9d8 /media/libstagefright/CameraSource.cpp | |
parent | 4c0c81a30733ba677c16db14a54349d80c642b5b (diff) | |
download | frameworks_base-997eaa2c7c6f7c59d145dab3e93431ea2e2a7dc7.zip frameworks_base-997eaa2c7c6f7c59d145dab3e93431ea2e2a7dc7.tar.gz frameworks_base-997eaa2c7c6f7c59d145dab3e93431ea2e2a7dc7.tar.bz2 |
0-memcpy video recording framework
Part III: Move startRecording() call earlier, asking camera hal
to allocate video buffers before CameraSource.start() is called.
Change-Id: I3f1d7d5636ca2644fe52af61f297d48c6b1ce89d
Diffstat (limited to 'media/libstagefright/CameraSource.cpp')
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index f7b76f8..1eb394a 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -451,6 +451,27 @@ status_t CameraSource::init( // This CHECK is good, since we just passed the lock/unlock // check earlier by calling mCamera->setParameters(). CHECK_EQ(OK, mCamera->setPreviewDisplay(mSurface)); + + /* + * mCamera->startRecording() signals camera hal to make + * available the video buffers (for instance, allocation + * of the video buffers may be triggered when camera hal's + * startRecording() method is called). Making available these + * video buffers earlier (before calling start()) is critical, + * if one wants to configure omx video encoders to use these + * buffers for passing video frame data during video recording + * without the need to memcpy the video frame data stored + * in these buffers. Eliminating memcpy for video frame data + * is crucial in performance for HD quality video recording + * applications. + * + * Based on OMX IL spec, configuring the omx video encoders + * must occur in loaded state. When start() is called, omx + * video encoders are already in idle state, which is too + * late. Thus, we must call mCamera->startRecording() earlier. + */ + startCameraRecording(); + IPCThreadState::self()->restoreCallingIdentity(token); int64_t glitchDurationUs = (1000000LL / mVideoFrameRate); @@ -478,6 +499,7 @@ CameraSource::~CameraSource() { void CameraSource::startCameraRecording() { CHECK_EQ(OK, mCamera->startRecording()); + CHECK(mCamera->recordingEnabled()); } status_t CameraSource::start(MetaData *meta) { @@ -501,7 +523,6 @@ status_t CameraSource::start(MetaData *meta) { int64_t token = IPCThreadState::self()->clearCallingIdentity(); mCamera->setListener(new CameraSourceListener(this)); - startCameraRecording(); IPCThreadState::self()->restoreCallingIdentity(token); mStarted = true; |