From bb004d5a33dde96fa9b54a1d36cd4c4303249b31 Mon Sep 17 00:00:00 2001 From: PacketVideo CM Date: Tue, 13 Oct 2009 22:40:34 -0700 Subject: [PATCH] RIO-7657: Report a more appropriate failure status via the author engine when underlying node commands fail --- android/author/authordriver.cpp | 29 +++++++++++++++++------------ engines/2way/src/pv_2way_sdkinfo.h | 2 +- engines/author/src/pv_author_sdkinfo.h | 2 +- engines/author/src/pvauthorengine.cpp | 8 ++++++-- engines/author/src/pvauthorengine.h | 2 ++ engines/player/src/pv_player_sdkinfo.h | 2 +- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/android/author/authordriver.cpp b/android/author/authordriver.cpp index c51306d5..16cf83aa 100644 --- a/android/author/authordriver.cpp +++ b/android/author/authordriver.cpp @@ -2,16 +2,16 @@ * Copyright (C) 2008, The Android Open Source Project * Copyright (C) 2008 HTC Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. */ @@ -332,7 +332,7 @@ void AuthorDriver::handleSetVideoSource(set_video_source_command *ac) mVideoNode = PvmfMediaInputNodeFactory::Create(cameraInput); if (mVideoNode) { // pass in the application supplied camera object - if (mCamera == 0 || + if (mCamera == 0 || (mCamera != 0 && cameraInput->SetCamera(mCamera) == PVMFSuccess)) { mVideoInputMIO = cameraInput; break; @@ -965,7 +965,7 @@ void AuthorDriver::handleRemoveVideoSource(author_command *ac) OSCL_TRY(error, mAuthor->RemoveDataSource(*mVideoNode, ac)); OSCL_FIRST_CATCH_ANY(error, commandFailed(ac)); } else { - FinishNonAsyncCommand(ac); + FinishNonAsyncCommand(ac); } } @@ -991,7 +991,7 @@ void AuthorDriver::removeConfigRefs(author_command *ac) } if (mVideoEncoderConfig) { mVideoEncoderConfig->removeRef(); - mVideoEncoderConfig = NULL; + mVideoEncoderConfig = NULL; } if (mAudioEncoderConfig) { mAudioEncoderConfig->removeRef(); @@ -1419,7 +1419,12 @@ void AuthorDriver::CommandCompleted(const PVCmdResponse& aResponse) switch(s) { case PVMFSuccess: s = android::OK; break; case PVMFPending: *(char *)0 = 0; break; /* XXX assert */ - default: s = android::UNKNOWN_ERROR; + default: + LOGE("Command %d completed with error %d",ac->which, s); + // s = android::UNKNOWN_ERROR; + // FIXME: Similar to mediaplayer, set the return status to + // something android specific. For now, use PVMF + // return codes as is. } // Call the user's requested completion function diff --git a/engines/2way/src/pv_2way_sdkinfo.h b/engines/2way/src/pv_2way_sdkinfo.h index 5f0d5734..9b16aa81 100644 --- a/engines/2way/src/pv_2way_sdkinfo.h +++ b/engines/2way/src/pv_2way_sdkinfo.h @@ -21,7 +21,7 @@ // This header file is automatically generated at build-time // *** OFFICIAL RELEASE INFO -- Will not auto update -#define PV2WAY_ENGINE_SDKINFO_LABEL "1005994" +#define PV2WAY_ENGINE_SDKINFO_LABEL "1005999" #define PV2WAY_ENGINE_SDKINFO_DATE 0x20091007 #endif //PV_2WAY_SDKINFO_H_INCLUDED diff --git a/engines/author/src/pv_author_sdkinfo.h b/engines/author/src/pv_author_sdkinfo.h index 0552c5ba..90effea5 100644 --- a/engines/author/src/pv_author_sdkinfo.h +++ b/engines/author/src/pv_author_sdkinfo.h @@ -21,7 +21,7 @@ // This header file is automatically generated at build-time // *** OFFICIAL RELEASE INFO -- Will not auto update -#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1005994" +#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1005999" #define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20091007 #endif //PV_AUTHOR_SDKINFO_H_INCLUDED diff --git a/engines/author/src/pvauthorengine.cpp b/engines/author/src/pvauthorengine.cpp index 22867e98..6e78aed2 100644 --- a/engines/author/src/pvauthorengine.cpp +++ b/engines/author/src/pvauthorengine.cpp @@ -103,6 +103,7 @@ PVAuthorEngine::PVAuthorEngine() : { iLogger = PVLogger::GetLoggerObject("PVAuthorEngine"); iDoResetNodeContainers = false; + lastNodeCommandError = PVMFFailure; } //////////////////////////////////////////////////////////////////////////// @@ -568,7 +569,10 @@ void PVAuthorEngine::NodeUtilCommandCompleted(const PVMFCmdResp& aResponse) return; } else + { + lastNodeCommandError = aResponse.GetCmdStatus(); SetPVAEState(PVAE_STATE_ERROR); + } } //RESET needs to be handled seperately, if the EngineState is ERROR, ignore all cmds till //there are more pending commands, else send out commandComplete Failure @@ -580,7 +584,7 @@ void PVAuthorEngine::NodeUtilCommandCompleted(const PVMFCmdResp& aResponse) } else { - CompleteEngineCommand(cmd, PVMFFailure); //Send Failure to this command, engine is in error state + CompleteEngineCommand(cmd, lastNodeCommandError); //Send Failure to this command, engine is in error state return; } } @@ -694,7 +698,7 @@ void PVAuthorEngine::NodeUtilCommandCompleted(const PVMFCmdResp& aResponse) { if (iState == PVAE_STATE_ERROR) { - CompleteEngineCommand(cmd, PVMFFailure); + CompleteEngineCommand(cmd, status); } else { diff --git a/engines/author/src/pvauthorengine.h b/engines/author/src/pvauthorengine.h index 6962da72..dbac3047 100644 --- a/engines/author/src/pvauthorengine.h +++ b/engines/author/src/pvauthorengine.h @@ -385,6 +385,8 @@ class PVAuthorEngine PVMFTimebase_Tickcount iAuthorClockTimebase; PVMFMediaClock iAuthorClock; PVMFStatus SendAuthoringClockToDataSources(bool aReset = false); + + PVMFStatus lastNodeCommandError; }; diff --git a/engines/player/src/pv_player_sdkinfo.h b/engines/player/src/pv_player_sdkinfo.h index e850bf74..f27cc659 100644 --- a/engines/player/src/pv_player_sdkinfo.h +++ b/engines/player/src/pv_player_sdkinfo.h @@ -21,7 +21,7 @@ // This header file is automatically generated at build-time // *** OFFICIAL RELEASE INFO -- Will not auto update -#define PVPLAYER_ENGINE_SDKINFO_LABEL "1005994" +#define PVPLAYER_ENGINE_SDKINFO_LABEL "1005999" #define PVPLAYER_ENGINE_SDKINFO_DATE 0x20091007 #endif //PV_PLAYER_SDKINFO_H_INCLUDED -- 2.11.0