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

Commit 8555d086 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

auto import from //depot/cupcake/@136594

parent 89fa4ad5
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -808,7 +808,14 @@ bool AudioTrack::processAudioBuffer(const sp<AudioTrackThread>& thread)
        writtenSize = audioBuffer.size;

        // Sanity check on returned size
        if (ssize_t(writtenSize) <= 0) break;
        if (ssize_t(writtenSize) <= 0) {
            // The callback is done filling buffers
            // Keep this thread going to handle timed events and
            // still try to get more data in intervals of WAIT_PERIOD_MS
            // but don't just loop and block the CPU, so wait
            usleep(WAIT_PERIOD_MS*1000);
            break;
        }
        if (writtenSize > reqSize) writtenSize = reqSize;

        if (mFormat == AudioSystem::PCM_8_BIT) {
+18 −18
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ status_t MediaRecorder::setCamera(const sp<ICamera>& camera)
    if (OK != ret) {
        LOGV("setCamera failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    return ret;
}
@@ -67,7 +67,7 @@ status_t MediaRecorder::setPreviewSurface(const sp<Surface>& surface)
    if (OK != ret) {
        LOGV("setPreviewSurface failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    return ret;
}
@@ -88,14 +88,14 @@ status_t MediaRecorder::init()
    if (OK != ret) {
        LOGV("init failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }

    ret = mMediaRecorder->setListener(this);
    if (OK != ret) {
        LOGV("setListener failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }

    mCurrentState = MEDIA_RECORDER_INITIALIZED;
@@ -129,7 +129,7 @@ status_t MediaRecorder::setVideoSource(int vs)
    if (OK != ret) {
        LOGV("setVideoSource failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mIsVideoSourceSet = true;
    return ret;
@@ -162,7 +162,7 @@ status_t MediaRecorder::setAudioSource(int as)
    if (OK != ret) {
        LOGV("setAudioSource failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mIsAudioSourceSet = true;
    return ret;
@@ -188,7 +188,7 @@ status_t MediaRecorder::setOutputFormat(int of)
    if (OK != ret) {
        LOGE("setOutputFormat failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mCurrentState = MEDIA_RECORDER_DATASOURCE_CONFIGURED;
    return ret;
@@ -218,7 +218,7 @@ status_t MediaRecorder::setVideoEncoder(int ve)
    if (OK != ret) {
        LOGV("setVideoEncoder failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mIsVideoEncoderSet = true;
    return ret;
@@ -248,7 +248,7 @@ status_t MediaRecorder::setAudioEncoder(int ae)
    if (OK != ret) {
        LOGV("setAudioEncoder failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mIsAudioEncoderSet = true;
    return ret;
@@ -274,7 +274,7 @@ status_t MediaRecorder::setOutputFile(const char* path)
    if (OK != ret) {
        LOGV("setOutputFile failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mIsOutputFileSet = true;
    return ret;
@@ -300,7 +300,7 @@ status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length)
    if (OK != ret) {
        LOGV("setOutputFile failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mIsOutputFileSet = true;
    return ret;
@@ -326,7 +326,7 @@ status_t MediaRecorder::setVideoSize(int width, int height)
    if (OK != ret) {
        LOGE("setVideoSize failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    return ret;
}
@@ -351,7 +351,7 @@ status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
    if (OK != ret) {
        LOGE("setVideoFrameRate failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    return ret;
}
@@ -389,7 +389,7 @@ status_t MediaRecorder::prepare()
    if (OK != ret) {
        LOGE("prepare failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mCurrentState = MEDIA_RECORDER_PREPARED;
    return ret;
@@ -411,7 +411,7 @@ status_t MediaRecorder::getMaxAmplitude(int* max)
    if (OK != ret) {
        LOGE("getMaxAmplitude failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    return ret;
}
@@ -432,7 +432,7 @@ status_t MediaRecorder::start()
    if (OK != ret) {
        LOGE("start failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mCurrentState = MEDIA_RECORDER_RECORDING;
    return ret;
@@ -454,7 +454,7 @@ status_t MediaRecorder::stop()
    if (OK != ret) {
        LOGE("stop failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    }
    mCurrentState = MEDIA_RECORDER_IDLE;
    return ret;
@@ -522,7 +522,7 @@ status_t MediaRecorder::doReset()
    if (OK != ret) {
        LOGE("doReset failed: %d", ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return UNKNOWN_ERROR;
        return ret;
    } else {
        mCurrentState = MEDIA_RECORDER_INITIALIZED;
    }