summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/CameraSource.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-05-27 01:57:08 -0700
committerJames Dong <jdong@google.com>2010-05-27 02:01:19 -0700
commita7414ea2c7dfea7d2428ce543bd6331d6c56aead (patch)
tree44a8c0b9202856874f58859242aa3f2bfc74c08b /media/libstagefright/CameraSource.cpp
parent5b39604a55f1624ced347da7b790c4206d2d999f (diff)
downloadframeworks_av-a7414ea2c7dfea7d2428ce543bd6331d6c56aead.zip
frameworks_av-a7414ea2c7dfea7d2428ce543bd6331d6c56aead.tar.gz
frameworks_av-a7414ea2c7dfea7d2428ce543bd6331d6c56aead.tar.bz2
Remove the logic in CameraSource using CameraParameters class to find out the buffer size.
Change-Id: I76eea76bda49529d08b46241d3dded1a804f891c
Diffstat (limited to 'media/libstagefright/CameraSource.cpp')
-rw-r--r--media/libstagefright/CameraSource.cpp29
1 files changed, 5 insertions, 24 deletions
diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp
index 87d7ebb..476b36d 100644
--- a/media/libstagefright/CameraSource.cpp
+++ b/media/libstagefright/CameraSource.cpp
@@ -119,23 +119,6 @@ CameraSource::~CameraSource() {
}
}
-static int bytesPerPixelTimes10(const char *colorFormat) {
- LOGI("color format: %s", colorFormat);
- return 20;
-#if 0
- // XXX: Fix Camera Hal bug?
- // On sholes, it returns CameraParameters::PIXEL_FORMAT_YUV420SP???
- if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV422SP) ||
- !strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV422I) ||
- !strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_RGB565)) {
- return 20;
- } else if (!strcmp(colorFormat, CameraParameters::PIXEL_FORMAT_YUV420SP)) {
- return 15;
- }
- CHECK_EQ(0, "Unknown color format");
-#endif
-}
-
status_t CameraSource::start(MetaData *) {
LOGV("start");
CHECK(!mStarted);
@@ -144,13 +127,6 @@ status_t CameraSource::start(MetaData *) {
CHECK_EQ(OK, mCamera->startRecording());
mStarted = true;
- mBufferGroup = new MediaBufferGroup();
- String8 s = mCamera->getParameters();
- CameraParameters params(s);
- const char *colorFormat = params.getPreviewFormat();
- const int size = (mWidth * mHeight * bytesPerPixelTimes10(colorFormat))/10;
- mBufferGroup->add_buffer(new MediaBuffer(size));
-
return OK;
}
@@ -222,6 +198,11 @@ status_t CameraSource::read(
mFrameTimes.erase(mFrameTimes.begin());
++mNumFramesEncoded;
}
+ if (mBufferGroup == NULL) {
+ mBufferGroup = new MediaBufferGroup();
+ CHECK(mBufferGroup != NULL);
+ mBufferGroup->add_buffer(new MediaBuffer(frame->size()));
+ }
mBufferGroup->acquire_buffer(buffer);
memcpy((*buffer)->data(), frame->pointer(), frame->size());