summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice/StagefrightRecorder.cpp
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2014-02-25 21:56:07 -0800
committerChong Zhang <chz@google.com>2014-02-26 10:44:51 -0800
commit1a5690652f3f6ee40f15c2f9f6c4b6badf4dbcf5 (patch)
tree2bfbca1610aa0124277262905ae7eb6bb171a2e1 /media/libmediaplayerservice/StagefrightRecorder.cpp
parent882469cfe767188a4c67d2d83f3d72ab553a4818 (diff)
downloadframeworks_av-1a5690652f3f6ee40f15c2f9f6c4b6badf4dbcf5.zip
frameworks_av-1a5690652f3f6ee40f15c2f9f6c4b6badf4dbcf5.tar.gz
frameworks_av-1a5690652f3f6ee40f15c2f9f6c4b6badf4dbcf5.tar.bz2
initialize encoder at start() time for camera source
Bug: 13156212 Change-Id: I845ef51f662f04c50179dbfb128204922a424e1d
Diffstat (limited to 'media/libmediaplayerservice/StagefrightRecorder.cpp')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index 845a589..5b7a236 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -748,7 +748,7 @@ status_t StagefrightRecorder::setClientName(const String16& clientName) {
return OK;
}
-status_t StagefrightRecorder::prepare() {
+status_t StagefrightRecorder::prepareInternal() {
ALOGV("prepare");
if (mOutputFd < 0) {
ALOGE("Output file descriptor is invalid");
@@ -794,6 +794,13 @@ status_t StagefrightRecorder::prepare() {
return status;
}
+status_t StagefrightRecorder::prepare() {
+ if (mVideoSource == VIDEO_SOURCE_SURFACE) {
+ return prepareInternal();
+ }
+ return OK;
+}
+
status_t StagefrightRecorder::start() {
ALOGV("start");
if (mOutputFd < 0) {
@@ -801,15 +808,20 @@ status_t StagefrightRecorder::start() {
return INVALID_OPERATION;
}
- // Get UID here for permission checking
- mClientUid = IPCThreadState::self()->getCallingUid();
+ status_t status = OK;
+
+ if (mVideoSource != VIDEO_SOURCE_SURFACE) {
+ status = prepareInternal();
+ if (status != OK) {
+ return status;
+ }
+ }
+
if (mWriter == NULL) {
ALOGE("File writer is not avaialble");
return UNKNOWN_ERROR;
}
- status_t status = OK;
-
switch (mOutputFormat) {
case OUTPUT_FORMAT_DEFAULT:
case OUTPUT_FORMAT_THREE_GPP: