aboutsummaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorJianhong Jiang <jianhong@google.com>2009-08-11 13:55:00 -0700
committerJianhong Jiang <jianhong@google.com>2009-08-11 13:55:00 -0700
commit054ddbdab800b1921b47d02c7810d00da34b0019 (patch)
tree4a11a8e26f5823c90798957cabf40328b37360c3 /android
parent2e6a721c1c99ece3f5920b52fb8271a1a518ef95 (diff)
downloadopencore-054ddbdab800b1921b47d02c7810d00da34b0019.tar.gz
Fix high frame rate encoding crash.
https://partner.source.android.com/g/#change,578 When recording video at 30fps, the android_camera_input.cpp method statusUpdate() returns an unhandled exception OsclErrNotSupported (103). Update the statusUpdate() for the AndroidCameraInput and AndroidAudioInput objects to avoid returning this exception.
Diffstat (limited to 'android')
-rw-r--r--android/author/android_audio_input.cpp13
-rw-r--r--android/author/android_camera_input.cpp26
-rw-r--r--android/author/android_camera_input.h3
3 files changed, 24 insertions, 18 deletions
diff --git a/android/author/android_audio_input.cpp b/android/author/android_audio_input.cpp
index 5fdfd8f0f..1b569e1b6 100644
--- a/android/author/android_audio_input.cpp
+++ b/android/author/android_audio_input.cpp
@@ -465,14 +465,11 @@ void AndroidAudioInput::readComplete(PVMFStatus aStatus, PVMFCommandId read_cmd_
////////////////////////////////////////////////////////////////////////////
void AndroidAudioInput::statusUpdate(uint32 status_flags)
{
- OSCL_UNUSED_ARG(status_flags);
- // Ideally this routine should update the status of media input component.
- // It should check then for the status. If media input buffer is consumed,
- // media input object should be resheduled.
- // Since the Media fileinput component is designed with single buffer, two
- // asynchronous reads are not possible. So this function will not be required
- // and hence not been implemented.
- OSCL_LEAVE(OsclErrNotSupported);
+ LOGV("statusUpdate");
+ if (status_flags != PVMI_MEDIAXFER_STATUS_WRITE)
+ {
+ OSCL_LEAVE(OsclErrNotSupported);
+ }
}
diff --git a/android/author/android_camera_input.cpp b/android/author/android_camera_input.cpp
index 5f51b2d28..b1bc947ee 100644
--- a/android/author/android_camera_input.cpp
+++ b/android/author/android_camera_input.cpp
@@ -39,7 +39,8 @@ OSCL_DLL_ENTRY_POINT_DEFAULT()
// camera MIO
AndroidCameraInput::AndroidCameraInput()
- : OsclTimerObject(OsclActiveObject::EPriorityNominal, "AndroidCameraInput")
+ : OsclTimerObject(OsclActiveObject::EPriorityNominal, "AndroidCameraInput"),
+ iWriteState(EWriteOK)
{
LOGV("constructor(%p)", this);
iCmdIdCounter = 0;
@@ -469,14 +470,15 @@ void AndroidCameraInput::readComplete(PVMFStatus aStatus,
void AndroidCameraInput::statusUpdate(uint32 status_flags)
{
LOGV("statusUpdate");
- OSCL_UNUSED_ARG(status_flags);
- // Ideally this routine should update the status of media input component.
- // It should check then for the status. If media input buffer is consumed,
- // media input object should be resheduled.
- // Since the Media fileinput component is designed with single buffer, two
- // asynchronous reads are not possible. So this function will not be
- // requiredand hence not been implemented.
- OSCL_LEAVE(OsclErrNotSupported);
+ if (status_flags != PVMI_MEDIAXFER_STATUS_WRITE)
+ {
+ OSCL_LEAVE(OsclErrNotSupported);
+ }
+ else
+ {
+ // Restart the flow of data
+ iWriteState = EWriteOK;
+ }
}
void AndroidCameraInput::cancelCommand(PVMFCommandId aCmdId)
@@ -737,6 +739,7 @@ void AndroidCameraInput::Run()
//release buffer immediately if write fails
mCamera->releaseRecordingFrame(data.iFrameBuffer);
iFrameQueue.erase(iFrameQueue.begin());
+ iWriteState = EWriteBusy;
break;
}
}
@@ -920,6 +923,7 @@ PVMFStatus AndroidCameraInput::DoStart()
{
LOGV("DoStart");
PVMFStatus status = PVMFFailure;
+ iWriteState = EWriteOK;
if (mCamera == NULL) {
status = PVMFFailure;
} else {
@@ -948,6 +952,7 @@ PVMFStatus AndroidCameraInput::DoReset()
{
LOGV("DoReset");
iDataEventCounter = 0;
+ iWriteState = EWriteOK;
if ( (iState == STATE_STARTED) || (iState == STATE_PAUSED) ) {
if (mCamera != NULL) {
mCamera->setListener(NULL);
@@ -980,6 +985,7 @@ PVMFStatus AndroidCameraInput::DoStop(const AndroidCameraInputCmd& aCmd)
{
LOGV("DoStop");
iDataEventCounter = 0;
+ iWriteState = EWriteOK;
if (mCamera != NULL) {
mCamera->setListener(NULL);
mCamera->stopRecording();
@@ -1101,7 +1107,7 @@ PVMFStatus AndroidCameraInput::postWriteAsync(nsecs_t timestamp, const sp<IMemor
// release the received recording frame right way
// if recording has not been started yet or recording has already finished
- if((!iPeer) || (!isRecorderStarting()) ) {
+ if((!iPeer) || (!isRecorderStarting()) || (iWriteState == EWriteBusy)) {
LOGV("Recording is not started, so recording frame is dropped");
mCamera->releaseRecordingFrame(frame);
return PVMFSuccess;
diff --git a/android/author/android_camera_input.h b/android/author/android_camera_input.h
index af400ec3a..b359bb31c 100644
--- a/android/author/android_camera_input.h
+++ b/android/author/android_camera_input.h
@@ -424,6 +424,9 @@ private:
AndroidCameraInputState iState;
+ enum WriteState {EWriteBusy, EWriteOK};
+ WriteState iWriteState;
+
};
#ifdef HIDE_MIO_SYMBOLS