Loading media/libmedia/AudioTrack.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -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) { Loading media/libmedia/mediarecorder.cpp +18 −18 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; } Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; Loading @@ -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; Loading @@ -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; } Loading @@ -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; } Loading Loading @@ -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; Loading @@ -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; } Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; } Loading Loading
media/libmedia/AudioTrack.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -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) { Loading
media/libmedia/mediarecorder.cpp +18 −18 Original line number Diff line number Diff line Loading @@ -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; } Loading @@ -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; } Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; Loading Loading @@ -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; Loading @@ -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; Loading @@ -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; Loading @@ -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; } Loading @@ -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; } Loading Loading @@ -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; Loading @@ -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; } Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; } Loading