Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 469b7b57 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "initialize encoder at start() time for camera source"

parents 1211dd9b 1a569065
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -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:
+1 −0
Original line number Diff line number Diff line
@@ -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();