summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2014-02-27 04:49:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-27 04:49:34 +0000
commit469b7b5703467590ae9de7f01462baf759d12fbb (patch)
treec6954f38be82b61faf68e719f6209ff5bee6d8ed /media
parent1211dd9bf7ca9a6745df60ee8152515b81208b4a (diff)
parent1a5690652f3f6ee40f15c2f9f6c4b6badf4dbcf5 (diff)
downloadframeworks_av-469b7b5703467590ae9de7f01462baf759d12fbb.zip
frameworks_av-469b7b5703467590ae9de7f01462baf759d12fbb.tar.gz
frameworks_av-469b7b5703467590ae9de7f01462baf759d12fbb.tar.bz2
Merge "initialize encoder at start() time for camera source"
Diffstat (limited to 'media')
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.cpp22
-rw-r--r--media/libmediaplayerservice/StagefrightRecorder.h1
2 files changed, 18 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:
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index 7d6abd3..377d168 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -127,6 +127,7 @@ private:
sp<IGraphicBufferProducer> mGraphicBufferProducer;
sp<ALooper> mLooper;
+ status_t prepareInternal();
status_t setupMPEG4Recording();
void setupMPEG4MetaData(sp<MetaData> *meta);
status_t setupAMRRecording();