void CompositionOffsetAtom::Run() { // Create it for the first time if ((MT_SampleCount == NULL) && (MT_EntryCount == NULL)) { PVMFStatus status = CreateMarkerTable(); if (status == PVMFFailure) { OSCL_LEAVE(OsclErrNoMemory); } iMarkerTableCreation = true; } PopulateMarkerTable(); // check for entry count being exhausted.. table iterated completely if ((entrycountTraversed < _entryCount) && (refSample < _iTotalNumSamplesInTrack) && (MT_Counter < _iTotalNumSamplesInTrack / MT_SAMPLECOUNT_INCREMENT)) { RunIfNotReady(); } return; }
void pv_mediainput_async_test_delete::HandleErrorEvent(const PVAsyncErrorEvent& aEvent) { OSCL_UNUSED_ARG(aEvent); PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_ERR, (0, "pv_mediainput_async_test_delete::HandleErrorEvent")); iState = PVAE_CMD_RESET; RunIfNotReady(); }
PVMFStatus PvmfJBSessionDurationTimer::Start() { PVMF_JBNODE_LOGINFO((0, "PvmfJBSessionDurationTimer::Start")); if ((iSessionDurationInMS > 0) && (iCurrentMonitoringIntervalInMS > 0)) { PVMF_JBNODE_LOGCLOCK_SESSION_DURATION((0, "PvmfJBSessionDurationTimer::Start - SessionDurationInMS = %d", iSessionDurationInMS)); iClock.Start(); uint64 timebase64 = 0; iTimerStartTimeInMS = 0; iMonitoringIntervalElapsed = 0; iClock.GetCurrentTime64(iTimerStartTimeInMS, OSCLCLOCK_MSEC, timebase64); /* Compute expected estimated serv clock value when duration expires */ if (iEstimatedServerClock != NULL) { iExpectedEstimatedServClockValAtSessionEnd = iEstimatedServClockValAtLastCancel; uint32 currEstServClk32 = Oscl_Int64_Utils::get_uint64_lower32(iExpectedEstimatedServClockValAtSessionEnd); PVMF_JBNODE_LOGCLOCK_SESSION_DURATION((0, "PvmfJBSessionDurationTimer::Start - CurrEstServClock = %d", currEstServClk32)); uint64 remainingSessionDuration64 = 0; Oscl_Int64_Utils::set_uint64(remainingSessionDuration64, 0, (iSessionDurationInMS - iElapsedSessionDurationInMS)); iExpectedEstimatedServClockValAtSessionEnd += remainingSessionDuration64; uint32 eVal32 = Oscl_Int64_Utils::get_uint64_lower32(iExpectedEstimatedServClockValAtSessionEnd); PVMF_JBNODE_LOGCLOCK_SESSION_DURATION((0, "PvmfJBSessionDurationTimer::Start - ExpectedEstimatedServClockValAtSessionEnd = %d", eVal32)); } RunIfNotReady(iCurrentMonitoringIntervalInMS*1000); iStarted = true; return PVMFSuccess; } return PVMFFailure; }
void test_base::InitFailed() { printf("\n*************** Test FAILED: InitFailed *************** \n"); if (timer) { timer->Cancel(); } RunIfNotReady(); }
PVMFStatus PvmfFirewallPacketTimer::Start() { PVMF_JBNODE_LOGINFO((0, "PvmfFirewallPacketTimer::Start")); iStarted = true; if (iFirewallPacketRecvTimeOutInMS > 0) { RunIfNotReady(iFirewallPacketRecvTimeOutInMS*1000); } return PVMFSuccess; }
PVMFStatus PvmfJBJitterBufferDurationTimer::setJitterBufferDurationInMS(uint32 duration) { PVMF_JBNODE_LOGINFO((0, "PvmfJBSessionDurationTimer::setJitterBufferDurationInMS")); if (iStarted) { // we're running... we can only DECREASE the jitter buffer value if (duration > iJitterBufferDurationInMS) { PVMF_JBNODE_LOGINFO( (0, "PvmfJBSessionDurationTimer::setJitterBufferDurationInMS: " "Attempting to increase timer value while running. %d to %d ms.", iJitterBufferDurationInMS, duration)); return PVMFFailure; } // get the current time in us uint32 currtime; bool overflow = false; iRunClock.GetCurrentTime32(currtime, overflow, OSCLCLOCK_USEC); OSCL_ASSERT(!overflow); // if the time elapsed is > 32bits, something is wrong // compare against the new duration uint32 durationUs = duration * 1000; // save a multiply if (durationUs > currtime) { // set a new Run for the outstanding balance Cancel(); RunIfNotReady(durationUs - currtime); } else { // the new duration has already elapsed - schedule a Run immediately RunIfNotReady(); } } // save the new duration iJitterBufferDurationInMS = duration; return PVMFSuccess; }
// // pv_metadata_engine_test section // void pv_metadata_engine_test::StartTest() { AddToScheduler(); iState = STATE_CREATE; // Retrieve the logger object iLogger = PVLogger::GetLoggerObject("PVMetadataEngineTest"); iPerfLogger = PVLogger::GetLoggerObject("pvmetestdiagnostics"); RunIfNotReady(); }
void PVMFLoopbackIOPort::Run() { //data should move through the ports only //when the node is active or flushing if (iNode->GetState() != EPVMFNodeStarted && !iNode->FlushPending()) return; //Process incoming messages if (!iWaiting && IncomingMsgQueueSize() > 0) { //dispatch the incoming data. if (ProcessIncomingMsg() != PVMFSuccess) iNode->ReportErrorEvent(PVMF_NODE_ERROR_EVENT_LAST, (OsclAny*)this); //re-schedule if more data if (!iWaiting && IncomingMsgQueueSize() > 0) { RunIfNotReady(); } } //Process outgoing messages if (OutgoingMsgQueueSize() > 0 && !IsConnectedPortBusy()) { //Send data to connected port PVMFStatus status = Send(); if (status != PVMFSuccess) iNode->ReportErrorEvent(PVMF_NODE_ERROR_EVENT_LAST, (OsclAny*)this); //Reschedule if there's more data to process... if (OutgoingMsgQueueSize() > 0 && !IsConnectedPortBusy()) { RunIfNotReady(); } } }
void PVFMVideoMIO::QueueCommandResponse(CommandResponse& aResp) { // Queue a command response and schedule processing. iCommandResponseQueue.push_back(aResp); // Cancel any timer delay so the command response will happen ASAP. if (IsBusy()) { Cancel(); } RunIfNotReady(); }
void CompositionOffsetAtom::SetSamplesCount(uint32 aSamplesCount) { _iTotalNumSamplesInTrack = aSamplesCount; if (_entryCount > ENABLE_MT_LOGIC_ON_CTTS_ENTRY_COUNT_VALUE) { //Make this AO active so Run() will be called when scheduler is started if (OsclExecScheduler::Current() != NULL) { RunIfNotReady(); } } }
PVMFStatus PvmfJBInactivityTimer::Start() { PVMF_JBNODE_LOGINFO((0, "PvmfJBInactivityTimer::Start")); if (iInactivityDurationInMS > 0) { RunIfNotReady(iInactivityDurationInMS*1000); iStarted = true; return PVMFSuccess; } else { return PVMFFailure; } }
void PVMIExternalDownloadFileMonitor::Run(void) { switch (iState) { case STATE_IDLE: break; case STATE_OPENING: { //Disable PVCache because it prevents file size updates. iFile.SetPVCacheSize(0); int32 status = iFile.Open ( iFileName.get_str(), Oscl_File::MODE_READ | Oscl_File::MODE_BINARY, iFileServer ); if (0 == status) //success { iState = STATE_MONITORING; Poll(); } //else, if there was an error when trying to open the file (such as //when the file doesn't exist yet) we do not proceed to the //monitoring state, so we will retry opening in a few milliseconds. } break; case STATE_MONITORING: Poll(); break; } uint32 now = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); if ((now - iLastChange) >= iTimeOutms) { //Notify all observers. iDownloadComplete = true; for (uint32 i = 0; i < iObservers.size(); i++) { iObservers[i]->DownloadUpdate(iBytesDownloaded, iDownloadComplete); } StopMonitoring(); return; } //Run again after PVMI_EDLFM_POLL_INTERVAL_MS * 1000 microseconds. RunIfNotReady(PVMI_EDLFM_POLL_INTERVAL_MS * 1000); }
void OmxDecTestBase::StartTestApp() { if (!IsAdded()) { AddToScheduler(); } RunIfNotReady(); OsclExecScheduler* sched = OsclExecScheduler::Current(); if (sched) { sched->StartScheduler(); } }
void init_test::InitSucceeded() { iRstCmdId = 0; int error; cleanup(); OSCL_TRY(error, iRstCmdId = terminal->Reset()); if (error) { test_is_true(false); RunIfNotReady(); } else { if (iCurrentRun >= (iMaxRuns - 1)) { test_is_true(true); } } }
void pv_mediainput_async_test_delete::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) { PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE, (0, "pv_mediainput_async_test_delete::HandleInformationalEvent")); OsclAny* eventData = NULL; switch (aEvent.GetEventType()) { case PVMF_COMPOSER_MAXFILESIZE_REACHED: case PVMF_COMPOSER_MAXDURATION_REACHED: PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "pv_mediainput_async_test_delete::HandleNodeInformationalEvent: Max file size reached")); Cancel(); PVPATB_TEST_IS_TRUE(true); CompleteTest(); break; case PVMF_COMPOSER_DURATION_PROGRESS: aEvent.GetEventData(eventData); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "pv_mediainput_async_test_delete::HandleNodeInformationalEvent: Duration progress: %d ms", (int32)eventData)); break; case PVMF_COMPOSER_FILESIZE_PROGRESS: aEvent.GetEventData(eventData); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "pv_mediainput_async_test_delete::HandleNodeInformationalEvent: File size progress: %d bytes", (int32)eventData)); break; case PVMF_COMPOSER_EOS_REACHED: //Engine already stopped at EOS so send reset command. iState = PVAE_CMD_RESET; //cancel recording timeout scheduled for timer object. Cancel(); RunIfNotReady(); break; default: break; } }
void pv_mediainput_async_test_errorhandling::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent) { PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE, (0, "pv_mediainput_async_test_errorhandling::HandleInformationalEvent")); switch (aEvent.GetEventType()) { case PVMF_COMPOSER_EOS_REACHED: //Engine already stopped at EOS so send reset command. iState = PVAE_CMD_RESET; Cancel(); RunIfNotReady(); PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE, (0, "pv_mediainput_async_test_errorhandling::HandleInformationalEvent: EOS reached")); break; default: break; } }
void PvmfMediaInputNodeOutPort::Start() { iWriteState = EWriteOK; #ifdef _TEST_AE_ERROR_HANDLING if (iNode->iError_Out_Queue_Busy) { PvmfPortBaseImpl::SetCapacity(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetReserve(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetThreshold(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetCapacity(EPVOutgoingDataQueue, 1); PvmfPortBaseImpl::SetReserve(EPVOutgoingDataQueue, 2); PvmfPortBaseImpl::SetThreshold(EPVOutgoingDataQueue, 100); } else { PvmfPortBaseImpl::SetCapacity(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetReserve(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetThreshold(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetCapacity(EPVOutgoingDataQueue, 10); PvmfPortBaseImpl::SetReserve(EPVOutgoingDataQueue, 10); PvmfPortBaseImpl::SetThreshold(EPVOutgoingDataQueue, 70); } #else PvmfPortBaseImpl::SetCapacity(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetReserve(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetThreshold(EPVIncomingDataQueue, 0); PvmfPortBaseImpl::SetCapacity(EPVOutgoingDataQueue, 10); PvmfPortBaseImpl::SetReserve(EPVOutgoingDataQueue, 10); PvmfPortBaseImpl::SetThreshold(EPVOutgoingDataQueue, 70); #endif iState = PvmfMediaInputNodeOutPort::PORT_STATE_STARTED; if (iNode->iMediaIOState == PvmfMediaInputNode::MIO_STATE_STARTED) { RunIfNotReady(); } }
OSCL_EXPORT_REF void PVMIExternalDownloadFileMonitor::MonitorFile ( const char* aFileName, uint32 aTimeOutms ) { if (iState == STATE_MONITORING) { //Already monitoring a file. OSCL_LEAVE(OsclErrGeneral); } iDownloadComplete = false; iBytesDownloaded = 0; iState = STATE_OPENING; iLastChange = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); iTimeOutms = aTimeOutms; iFileServer.Connect(); iFileName = aFileName; //Run immediately. AddToScheduler(); RunIfNotReady(); }
PVMFStatus PvmfJBJitterBufferDurationTimer::Start() { PVMF_JBNODE_LOGINFO((0, "PvmfJBJitterBufferDurationTimer::Start")); if (iJitterBufferDurationInMS > 0) { RunIfNotReady(iJitterBufferDurationInMS*1000); uint32 startTime = 0; // setup timer iRunClock.Stop(); bool result = iRunClock.SetStartTime32(startTime, OSCLCLOCK_USEC); OSCL_ASSERT(result); result = iRunClock.Start(); OSCL_ASSERT(result); iStarted = true; return PVMFSuccess; } else { return PVMFFailure; } }
void pv_metadata_engine_test::Run() { int error = 0; switch (iState) { case STATE_CREATE: { iPVMEContainer.iCmdStatusObserver = this; iPVMEContainer.iInfoEventObserver = this; iPVMEContainer.iErrorEventObserver = this; iPVMEContainer.iMode = iMode; if (iPVMEContainer.iMode == PV_METADATA_ENGINE_THREADED_MODE) { //Configure the threadsafe queues that are used for engine //thread callbacks. iThreadSafeCommandQueue.Configure(this); iThreadSafeErrorQueue.Configure(this); iThreadSafeInfoQueue.Configure(this); iPVMEContainer.iSem.Create(); iPVMEContainer.iAppenderType = iLoggerInfo.iAppenderType; iPVMEContainer.iLogfilename = iLoggerInfo.logfilename; iPVMEContainer.iLoggerConfigElements = iLoggerInfo.iLoggerConfigElements; } OSCL_TRY(error, PVMetadataEngineFactory::CreatePVMetadataEngine(iPVMEContainer)); PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::Create Called ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); if (error || iPVMEContainer.iPVMEInterface == NULL) { PVMEATB_TEST_IS_TRUE(false); iObserver->TestCompleted(*iTestCase); } else { iState = STATE_INIT; RunIfNotReady(); } } break; case STATE_INIT: { PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::Init Issued ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); iCurrentCmdId = iPVMEContainer.iPVMEInterface->Init((OsclAny*) & iContextObject); } break; case STATE_SETMETADATAKEYS: { ReadMetadataFile(); ReadClipsFile(); if (iClipFilePresent == false) { fprintf(file, "\nClip File Not Present \n"); iState = STATE_RESET; RunIfNotReady(); } else if (iMetadataKeyList.size() != 0) { PVMFStatus status; PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::SetMetadataKeys Issued ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); status = iPVMEContainer.iPVMEInterface->SetMetaDataKeys(iMetadataKeyList); if (status == PVMFErrInvalidState) { PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::SetMetadataKeys called in wrong state")); } else { iState = STATE_GETMETADATA; RunIfNotReady(); } } else { iState = STATE_GETMETADATA; RunIfNotReady(); } } break; case STATE_GETMETADATA: { //If GetMetadata is being called second time in MultipleGetMetadataTest, we don't want these statements to execute again if (iDataSource == NULL) { // Create a player data source and add it iDataSource = new PVPlayerDataSourceURL; } OSCL_wHeapString<OsclMemAllocator> inputfilename; // Convert the source file name to UCS2 and extract the filename part PVMFFormatType iFileType; iFileName = *it; it++; GetSourceFormatType(iFileName, iFileType); oscl_UTF8ToUnicode(iFileName, oscl_strlen(iFileName), iTempWCharBuf, 512); wFileName.set(iTempWCharBuf, oscl_strlen(iTempWCharBuf)); RetrieveFilename(wFileName.get_str(), inputfilename); printf("\nInput File Name is %s", iFileName); iDataSource->SetDataSourceURL(wFileName); iDataSource->SetDataSourceFormatType(iFileType); start_time = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::GetMetadata Issued ClockInMS = (%d)", start_time)); OSCL_TRY(error, iCurrentCmdId = iPVMEContainer.iPVMEInterface->GetMetadata(*iDataSource, iMetadataValueList, (OsclAny*) & iContextObject)); OSCL_FIRST_CATCH_ANY(error, PVMEATB_TEST_IS_TRUE(false); iState = STATE_RESET; RunIfNotReady()); } break; case STATE_RESET: { PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::Reset Issued ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); iCurrentCmdId = iPVMEContainer.iPVMEInterface->Reset((OsclAny*) & iContextObject); } break; case STATE_DELETE: { PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::Delete Called ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); PVMFStatus status = PVMetadataEngineFactory::DeletePVMetadataEngine(iPVMEContainer); if (status != PVMFSuccess) { PVMEATB_TEST_IS_TRUE(false); } delete iDataSource; iDataSource = NULL; iFS.Close(); if (iPVMEContainer.iMode == PV_METADATA_ENGINE_THREADED_MODE) { iPVMEContainer.iSem.Close(); } PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::TotalNumClips=%d", numOfClips)); PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::AverageGetMetaDataTimeInMS=%d", (AverageGetMetaDataTimeInMS / numOfClips))); PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::MaxGetMetaDataTime=%d", MaxGetMetaDataTime)); PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::MinGetMetaDataTime=%d", MinGetMetaDataTime)); iObserver->TestCompleted(*iTestCase); } break; default: break; } }
void pv_metadata_engine_test::CommandCompleted(const PVCmdResponse& aResponse) { //if this callback is from pvme thread, then push it across the thread //boundary. if (iPVMEContainer.iMode == PV_METADATA_ENGINE_THREADED_MODE) { if (!iThreadSafeCommandQueue.IsInThread()) { PVCmdResponse* cmd = OSCL_NEW(PVCmdResponse, (aResponse)); iThreadSafeCommandQueue.AddToQueue(cmd); return; } } if (aResponse.GetCmdId() != iCurrentCmdId) { // Wrong command ID. PVMEATB_TEST_IS_TRUE(false); iState = STATE_RESET; RunIfNotReady(); return; } if (aResponse.GetContext() != NULL) { if (aResponse.GetContext() == (OsclAny*)&iContextObject) { if (iContextObject != iContextObjectRefValue) { // Context data value was corrupted PVMEATB_TEST_IS_TRUE(false); iState = STATE_RESET; RunIfNotReady(); return; } } else { // Context data pointer was corrupted PVMEATB_TEST_IS_TRUE(false); iState = STATE_RESET; RunIfNotReady(); return; } } switch (iState) { case STATE_INIT: if (aResponse.GetCmdStatus() == PVMFSuccess) { PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::Init completed sucessfully ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); iState = STATE_SETMETADATAKEYS; RunIfNotReady(); } else { // Init failed PVMEATB_TEST_IS_TRUE(false); PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::Init failed ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); iState = STATE_RESET; RunIfNotReady(); } break; case STATE_GETMETADATA: if (aResponse.GetCmdStatus() == PVMFSuccess) { end_time = OsclTickCount::TicksToMsec(OsclTickCount::TickCount()); AverageGetMetaDataTimeInMS = AverageGetMetaDataTimeInMS + (end_time - start_time); if (MaxGetMetaDataTime < (end_time - start_time)) { MaxGetMetaDataTime = (end_time - start_time); } if (metadataForFirstClip == true) //If this is the first clip { MinGetMetaDataTime = (end_time - start_time); } if (MinGetMetaDataTime > (end_time - start_time)) { MinGetMetaDataTime = (end_time - start_time); } PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::GetMetaData completed sucessfully ClockInMS=(%d), TimeTakenInMS=(%d)", end_time, (end_time - start_time))); PrintSupportedMetaDataKeys(); if (it < iClips.end()) { iState = STATE_GETMETADATA; metadataForFirstClip = false; } else { iState = STATE_RESET; } RunIfNotReady(); } else { // GetMetadata failed PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::GetMetadata failed ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); PVMEATB_TEST_IS_TRUE(false); iState = STATE_RESET; RunIfNotReady(); } break; case STATE_RESET: if (aResponse.GetCmdStatus() == PVMFSuccess) { PVLOGGER_LOGMSG(PVLOGMSG_INST_PROF, iPerfLogger, PVLOGMSG_INFO, (0, "PVMetadataEngineTest::Reset completed sucessfully ClockInMS=%d", OsclTickCount::TicksToMsec(OsclTickCount::TickCount()))); PVMEATB_TEST_IS_TRUE(true); iState = STATE_DELETE; RunIfNotReady(); } break; default: { // Testing error if this is reached PVMEATB_TEST_IS_TRUE(false); iState = STATE_RESET; RunIfNotReady(); } break; } }
OMX_ERRORTYPE OmxDecTestBase::FillBufferDone(OMX_OUT OMX_HANDLETYPE aComponent, OMX_OUT OMX_PTR aAppData, OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer) { OSCL_UNUSED_ARG(aComponent); OSCL_UNUSED_ARG(aAppData); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestBase::FillBufferDone() - IN")); //Check the validity of buffer if (NULL == aBuffer || OMX_DirOutput != aBuffer->nOutputPortIndex) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::FillBufferDone() - ERROR, Invalid buffer found in callback, OUT")); iState = StateError; RunIfNotReady(); return OMX_ErrorBadParameter; } OMX_U8* pOutputBuffer; OMX_U32 ii = 0; pOutputBuffer = (OMX_U8*)(aBuffer->pBuffer); //Output buffer has been freed by component & can now be passed again in FillThisBuffer call if (NULL != aBuffer) { if (0 != aBuffer->nFilledLen) { if (WriteOutput(pOutputBuffer, aBuffer->nFilledLen)) { /* Clear the output buffer after writing to file, * so that there is no chance of getting it written again while flushing port */ aBuffer->nFilledLen = 0; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::FillBufferDone() - Frame %i processed Timestamp %d", iFramesWritten, aBuffer->nTimeStamp)); iFramesWritten++; } else { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::FillBufferDone() - ERROR, Failed to write output to file")); } } } while (((OMX_U32) ipOutBuffer[ii] != (OMX_U32) aBuffer) && (ii < iOutBufferCount)) { ii++; } if (iOutBufferCount != ii) { //If the buffer is already returned and then a callback comes for same buffer //report an error and stop if (OMX_TRUE == ipOutReleased[ii]) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::FillBufferDone() - ERROR, Same bufer with index %d returned twice", ii)); iState = StateError; RunIfNotReady(); } ipOutReleased[ii] = OMX_TRUE; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::FillBufferDone() - Output buffer with index %d marked free", ii)); } else { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::FillBufferDone() - ERROR, Invalid buffer found in callback, cannot mark it free")); iState = StateError; RunIfNotReady(); } //To simulate output busy condition iCount++; if (0 == (iCount % 5)) { iStopOutput = OMX_TRUE; } if (0 >= iPendingCommands) { RunIfNotReady(); } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestBase::FillBufferDone() - OUT")); return OMX_ErrorNone; }
OMX_ERRORTYPE OmxDecTestBase::EmptyBufferDone(OMX_OUT OMX_HANDLETYPE aComponent, OMX_OUT OMX_PTR aAppData, OMX_OUT OMX_BUFFERHEADERTYPE* aBuffer) { OSCL_UNUSED_ARG(aComponent); OSCL_UNUSED_ARG(aAppData); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestBase::EmptyBufferDone() - IN")); //Check the validity of buffer if (NULL == aBuffer || OMX_DirInput != aBuffer->nInputPortIndex) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::EmptyBufferDone() - ERROR, Invalid buffer found in callback, OUT")); iState = StateError; RunIfNotReady(); return OMX_ErrorBadParameter; } //ACTUAL PROCESSING OMX_U32 ii = 0; while ((OMX_U32)(ipInBuffer[ii]) != (OMX_U32) aBuffer && ii < iInBufferCount) { ii++; } if (iInBufferCount != ii) { //If the buffer is already returned and then a callback comes for same buffer //report an error and stop if (OMX_TRUE == ipInputAvail[ii]) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::EmptyBufferDone() - ERROR, Same bufer with index %d returned twice", ii)); iState = StateError; RunIfNotReady(); } ipInputAvail[ii] = OMX_TRUE; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EmptyBufferDone() - Input buffer with index %d returned in callback", ii)); } else { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::EmptyBufferDone() - ERROR, Invalid buffer found in callback, cannot mark it free")); iState = StateError; RunIfNotReady(); } iInputReady = OMX_TRUE; //To simulate input busy condition iCount3++; if (0 == (iCount3 % 2)) { iStopInput = OMX_TRUE; } if (0 >= iPendingCommands) { RunIfNotReady(); } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestBase::EmptyBufferDone() - OUT")); return OMX_ErrorNone; }
OMX_ERRORTYPE OmxDecTestBase::EventHandler(OMX_OUT OMX_HANDLETYPE aComponent, OMX_OUT OMX_PTR aAppData, OMX_OUT OMX_EVENTTYPE aEvent, OMX_OUT OMX_U32 aData1, OMX_OUT OMX_U32 aData2, OMX_OUT OMX_PTR aEventData) { OSCL_UNUSED_ARG(aComponent); OSCL_UNUSED_ARG(aAppData); OSCL_UNUSED_ARG(aEventData); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestBase::EventHandler() - IN")); if (OMX_EventCmdComplete == aEvent) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Command Complete callback arrived")); if (OMX_CommandStateSet == aData1) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - State Changed callback has come under Command Complete")); switch ((OMX_S32) aData2) { //Falling through next case case OMX_StateInvalid: case OMX_StateWaitForResources: break; case OMX_StateLoaded: { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Callback, State Changed to OMX_StateLoaded")); if (StateCleanUp == iState) { iState = StateStop; if (0 == --iPendingCommands) { RunIfNotReady(); } } } break; case OMX_StateIdle: { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Callback, State Changed to OMX_StateIdle")); if (StateStopping == iState || StateDynamicReconfig == iState || StateDisablePort == iState || StateDecodeHeader == iState) { iState = StateCleanUp; if (0 == --iPendingCommands) { RunIfNotReady(); } } //this will be the case in EOS missing test case, go to a stopping state now else if (StateExecuting == iState) { iState = StateStopping; if (0 == --iPendingCommands) { RunIfNotReady(); } } else if (StateStop == iState || StateError == iState) { //Do not change the state because error has occured previously RunIfNotReady(); } else { iState = StateIdle; if (0 == --iPendingCommands) { RunIfNotReady(); } } } break; case OMX_StateExecuting: //Change the state on receiving callback { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Callback, State Changed to OMX_StateExecuting")); if (StateIdle == iState) //Chk whether some error condition has occured previously or not { iState = StateDecodeHeader; if (0 == --iPendingCommands) { RunIfNotReady(); } } else if (StatePause == iState) { iState = StateExecuting; if (0 == --iPendingCommands) { RunIfNotReady(); } } } break; case OMX_StatePause: //Change the state on receiving callback { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Callback, State Changed to OMX_StatePause")); if (StateExecuting == iState) { iState = StatePause; if (0 == --iPendingCommands) { RunIfNotReady(); } } } break; default: break; } } else if (OMX_CommandPortDisable == aData1) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Port Disable callback has come under Command Complete")); //Do the transition only if no error has occured previously if (StateStop != iState && StateError != iState) { iState = StateDynamicReconfig; if (0 == --iPendingCommands) { RunIfNotReady(); } } } else if (OMX_CommandPortEnable == aData1) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Port Enable callback has come under Command Complete")); //Change the state from Reconfig to Executing on receiving this callback if there is no error if (StateStop != iState && StateError != iState) { iState = StateExecuting; if (0 == --iPendingCommands) { RunIfNotReady(); } } } else if (OMX_CommandFlush == aData1) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Flush Port callback has come under Command Complete")); if (0 == --iPendingCommands) { //Move to a intermediate state for port/buffer verification iState = StateIntermediate; RunIfNotReady(); } } } else if (OMX_EventPortSettingsChanged == aEvent) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - Port Settings Changed callback arrived")); if (StateDecodeHeader == iState || StateExecuting == iState) { iState = StateDisablePort; iDisableRun = OMX_FALSE; iFlagDisablePort = OMX_FALSE; RunIfNotReady(); } } else if (OMX_EventBufferFlag == aEvent) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestBase::EventHandler() - End Of Stream callback arrived")); //callback for EOS //Change the state on receiving EOS callback iState = StateStopping; if (0 == --iPendingCommands) { RunIfNotReady(); } } else if (OMX_EventError == aEvent) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::EventHandler() - Error returned in the callback")); if (OMX_ErrorSameState == (OMX_S32)aData1) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::EventHandler() - Same State Error, trying to proceed")); if (StateCleanUp == iState) { iState = StateStop; if (0 == --iPendingCommands) { RunIfNotReady(); } } } else if (OMX_ErrorStreamCorrupt == (OMX_S32)aData1) { /* Don't do anything right now for the stream corrupt error, * just count the number of such callbacks and let the decoder to proceed */ iStreamCorruptCount++; PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestBase::EventHandler() - Stream Corrupt Error, total as of now is %d", iStreamCorruptCount)); } else { // do nothing, just try to proceed normally } } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestBase::EventHandler() - OUT")); return OMX_ErrorNone; }
//////////////////////////////////////////////////////////////////////////// // Pure virtuals from OsclActiveObject //////////////////////////////////////////////////////////////////////////// void PVMFAvcEncPort::Run() { LOG_STACK_TRACE((0, "PVMFAvcEncPort::Run")); PVMFStatus status = PVMFSuccess; // Process incoming messages if (iTag == PVMF_AVCENC_NODE_PORT_TYPE_INPUT) { if (IncomingMsgQueueSize() > 0) { //dispatch the incoming data. if (iNode->IsProcessIncomingMsgReady()) { status = iNode->ProcessIncomingMsg(this); if (status != PVMFSuccess) { LOG_ERR((0, "PVMFAvcEncPort::Run: Error - ProcessIncomingMsg failed. status=%d", status)); } } } if (iNode->IsFlushPending()) { if (IncomingMsgQueueSize() == 0 && OutgoingMsgQueueSize() == 0) { iNode->FlushComplete(); } else { RunIfNotReady(); } } } //Process outgoing messages if (iTag == PVMF_AVCENC_NODE_PORT_TYPE_OUTPUT) { if (OutgoingMsgQueueSize() > 0) { if (iNode->IsProcessOutgoingMsgReady()) { //Send data to connected port status = Send(); switch (status) { case PVMFSuccess: // Reschedule if there's more data to process and connected port did not become busy // after receiving the last msg if (OutgoingMsgQueueSize() > 0 && iNode->IsProcessOutgoingMsgReady()) { RunIfNotReady(); } break; case PVMFErrBusy: // Connected port busy. Don't schedule next data break; default: LOG_ERR((0, "PVMFAvcEncPort::Run: Error - Send() failed. status=%d", status)); iNode->ReportErrorEvent(PVMF_AVCENC_NODE_ERROR_ENCODE_ERROR, (OsclAny*)this); break; } if (iNode->IsFlushPending()) { if (IncomingMsgQueueSize() == 0 && OutgoingMsgQueueSize() == 0) iNode->FlushComplete(); } } } if (iNode->IsFlushPending()) { if (IncomingMsgQueueSize() == 0 && OutgoingMsgQueueSize() == 0) iNode->FlushComplete(); } } }
void OmxEncTestCompRole::Run() { switch (iState) { case StateUnLoaded: { OMX_ERRORTYPE Err; OMX_U32 ii; OMX_U32 NumComps = 0; OMX_STRING* pCompOfRole = NULL; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxEncTestCompRole::Run() - StateUnLoaded IN")); #if PROXY_INTERFACE ipThreadSafeHandlerEventHandler = OSCL_NEW(OmxEncEventHandlerThreadSafeCallbackAO, (this, EVENT_HANDLER_QUEUE_DEPTH, "EventHandlerAO")); ipThreadSafeHandlerEmptyBufferDone = OSCL_NEW(OmxEncEmptyBufferDoneThreadSafeCallbackAO, (this, EMPTY_BUFFER_DONE_QUEUE_DEPTH, "EmptyBufferDoneAO")); ipThreadSafeHandlerFillBufferDone = OSCL_NEW(OmxEncFillBufferDoneThreadSafeCallbackAO, (this, FILL_BUFFER_DONE_QUEUE_DEPTH, "FillBufferDoneAO")); if ((NULL == ipThreadSafeHandlerEventHandler) || (NULL == ipThreadSafeHandlerEmptyBufferDone) || (NULL == ipThreadSafeHandlerFillBufferDone)) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxEncTestCompRole::Run() - Error, ThreadSafe Callback Handler initialization failed, OUT")); iState = StateUnLoaded; OsclExecScheduler* sched = OsclExecScheduler::Current(); sched->StopScheduler(); } #endif if (!iCallbacks->initCallbacks()) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxEncTestCompRole::Run() - ERROR initCallbacks failed, OUT")); iTestStatus = OMX_FALSE; iState = StateStop; RunIfNotReady(); break; } ipAppPriv = (AppPrivateType*) oscl_malloc(sizeof(AppPrivateType)); CHECK_MEM_ROLE_TEST(ipAppPriv, "Component_Handle"); //This should be the first call to the component to load it. Err = OMX_MasterInit(); CHECK_ERROR_ROLE_TEST(Err, "OMX_MasterInit"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxEncTestCompRole::Run() - OMX_MasterInit done")); if (NULL != iRole) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxEncTestCompRole::Run() - Finding out the components that can support the role %s", iRole)); //Given the role, determine the component first & then get the handle // Call once to find out the number of components that can fit the role Err = OMX_MasterGetComponentsOfRole(iRole, &NumComps, NULL); if (OMX_ErrorNone != Err || NumComps < 1) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxEncTestCompRole::Run() - ERROR, No component can handle the specified role %s", iRole)); iTestStatus = OMX_FALSE; ipAppPriv->Handle = NULL; iState = StateStop; RunIfNotReady(); break; } pCompOfRole = (OMX_STRING*) oscl_malloc(NumComps * sizeof(OMX_STRING)); CHECK_MEM_ROLE_TEST(pCompOfRole, "ComponentRoleArray"); for (ii = 0; ii < NumComps; ii++) { pCompOfRole[ii] = (OMX_STRING) oscl_malloc(PV_OMX_MAX_COMPONENT_NAME_LENGTH * sizeof(OMX_U8)); CHECK_MEM_ROLE_TEST(pCompOfRole[ii], "ComponentRoleArray"); } if (OMX_FALSE == iTestStatus) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxEncTestCompRole::Run() - Error occured in this state, StateUnLoaded OUT")); break; } // call 2nd time to get the component names Err = OMX_MasterGetComponentsOfRole(iRole, &NumComps, (OMX_U8**) pCompOfRole); CHECK_ERROR_ROLE_TEST(Err, "GetComponentsOfRole"); for (ii = 0; ii < NumComps; ii++) { // try to create component Err = OMX_MasterGetHandle(&ipAppPriv->Handle, (OMX_STRING) pCompOfRole[ii], (OMX_PTR) this, iCallbacks->getCallbackStruct()); // if successful, no need to continue if ((OMX_ErrorNone == Err) && (NULL != ipAppPriv->Handle)) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxEncTestCompRole::Run() - Got Handle for the component %s", pCompOfRole[ii])); break; } else { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxEncTestCompRole::Run() - ERROR, Cannot get component %s handle, try another if possible", pCompOfRole[ii])); } } CHECK_ERROR_ROLE_TEST(Err, "GetHandle"); CHECK_MEM_ROLE_TEST(ipAppPriv->Handle, "ComponentHandle"); } //Free the role of component arrays if (pCompOfRole) { for (ii = 0; ii < NumComps; ii++) { oscl_free(pCompOfRole[ii]); pCompOfRole[ii] = NULL; } oscl_free(pCompOfRole); pCompOfRole = NULL; } iState = StateStop; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxEncTestCompRole::Run() - StateUnLoaded OUT, moving to next state")); RunIfNotReady(); } break; /********* FREE THE HANDLE & CLOSE FILES FOR THE COMPONENT ********/ case StateStop: { OMX_U8 TestName[] = "GET_ROLES_TEST"; OMX_ERRORTYPE Err = OMX_ErrorNone; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxEncTestCompRole::Run() - StateStop IN")); if (ipAppPriv) { if (ipAppPriv->Handle) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxEncTestCompRole::Run() - Free the Component Handle")); Err = OMX_MasterFreeHandle(ipAppPriv->Handle); if (OMX_ErrorNone != Err) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxEncTestCompRole::Run() - FreeHandle Error")); iTestStatus = OMX_FALSE; } } } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxEncTestCompRole::Run() - De-initialize the omx component")); Err = OMX_MasterDeinit(); if (OMX_ErrorNone != Err) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxEncTestCompRole::Run() - OMX_MasterDeinit Error")); iTestStatus = OMX_FALSE; } if (ipAppPriv) { oscl_free(ipAppPriv); ipAppPriv = NULL; } #if PROXY_INTERFACE OSCL_DELETE(ipThreadSafeHandlerEventHandler); ipThreadSafeHandlerEventHandler = NULL; OSCL_DELETE(ipThreadSafeHandlerEmptyBufferDone); ipThreadSafeHandlerEmptyBufferDone = NULL; OSCL_DELETE(ipThreadSafeHandlerFillBufferDone); ipThreadSafeHandlerFillBufferDone = NULL; #endif if (OMX_FALSE == iTestStatus) { #ifdef PRINT_RESULT printf("%s: Fail \n", TestName); #endif PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "OmxComponentEncTest::VerifyOutput() - %s : Fail", TestName)); } else { #ifdef PRINT_RESULT printf("%s: Success \n", TestName); OMX_ENC_TEST(true); iTestCase->TestCompleted(); #endif PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_INFO, (0, "OmxComponentEncTest::VerifyOutput() - %s : Success", TestName)); } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxEncTestCompRole::Run() - StateStop OUT")); iState = StateUnLoaded; OsclExecScheduler* sched = OsclExecScheduler::Current(); sched->StopScheduler(); } break; default: { break; } } return ; }
void pff_eos_test::CommandCompletedL(const CPVCmnCmdResp& aResponse) { int error = 0; switch (aResponse.GetCmdType()) { case PVT_COMMAND_INIT: if (aResponse.GetCmdStatus() == PVMFSuccess) { OSCL_TRY(error, terminal->InitPlayFileL(iFilename)); if (error) { test_is_true(false); reset(); } } else { test_is_true(false); RunIfNotReady(); } break; case PVT_COMMAND_RESET: RunIfNotReady(); break; case PVT_COMMAND_ADD_DATA_SOURCE: if (aResponse.GetCmdId() == iAudioAddSourceId) { if (aResponse.GetCmdStatus() == PVMFSuccess) { iAudioSourceAdded = true; if (check_audio_started() && check_video_started()) { OSCL_TRY(error, terminal->StartPlayL()); if (error) { test_is_true(false); disconnect(); } } } else { test_is_true(false); disconnect(); } iAudioAddSourceId = 0; } else if (aResponse.GetCmdId() == iVideoAddSourceId) { if (aResponse.GetCmdStatus() == PVMFSuccess) { iVideoSourceAdded = true; if (check_audio_started() && check_video_started()) { OSCL_TRY(error, terminal->StartPlayL()); if (error) { test_is_true(false); disconnect(); } } } else { test_is_true(false); disconnect(); } iVideoAddSourceId = 0; } break; case PVT_COMMAND_REMOVE_DATA_SOURCE: if (aResponse.GetCmdId() == iAudioRemoveSourceId) { iAudioRemoveSourceId = 0; iAudioSourceAdded = false; } else if (aResponse.GetCmdId() == iVideoRemoveSourceId) { iVideoRemoveSourceId = 0; iVideoSourceAdded = false; } break; case PVT_COMMAND_ADD_DATA_SINK: if (aResponse.GetCmdId() == iAudioAddSinkId) { if (aResponse.GetCmdStatus() == PVMFSuccess) { iAudioSinkAdded = true; if (check_audio_started() && check_video_started()) { OSCL_TRY(error, terminal->StartPlayL()); if (error) { test_is_true(false); disconnect(); } } } else { test_is_true(false); disconnect(); } iAudioAddSinkId = 0; } else if (aResponse.GetCmdId() == iVideoAddSinkId) { if (aResponse.GetCmdStatus() == PVMFSuccess) { iVideoSinkAdded = true; if (check_audio_started() && check_video_started()) { OSCL_TRY(error, terminal->StartPlayL()); if (error) { test_is_true(false); disconnect(); } } } else { test_is_true(false); disconnect(); } iVideoAddSinkId = 0; } break; case PVT_COMMAND_REMOVE_DATA_SINK: if (aResponse.GetCmdId() == iAudioRemoveSinkId) { iAudioRemoveSinkId = 0; iAudioSinkAdded = false; } else if (aResponse.GetCmdId() == iVideoRemoveSinkId) { iVideoRemoveSinkId = 0; iVideoSinkAdded = false; } break; case PVT_COMMAND_CONNECT: if (aResponse.GetCmdStatus() == PVMFSuccess) { OSCL_TRY(error, iAudioAddSourceId = terminal->AddDataSourceL(*iAudioSource)); if (error) { test_is_true(false); disconnect(); } OSCL_TRY(error, iVideoAddSourceId = terminal->AddDataSourceL(*iVideoSource)); if (error) { test_is_true(false); disconnect(); } } else { test_is_true(false); reset(); } break; case PVT_COMMAND_DISCONNECT: iAudioSourceAdded = false; iVideoSourceAdded = false; iAudioSinkAdded = false; iVideoSinkAdded = false; OSCL_TRY(error, terminal->ResetPlayFileL()); if (error) { reset(); } break; case PVT_COMMAND_INIT_PLAY_FILE: if (aResponse.GetCmdStatus() == PVMFSuccess) { OSCL_TRY(error, terminal->ConnectL(iConnectOptions)); if (error) { test_is_true(false); reset(); } } else { test_is_true(false); reset(); } break; case PVT_COMMAND_RESET_PLAY_FILE: reset(); break; case PVT_COMMAND_START_PLAY: if (aResponse.GetCmdStatus() == PVMFSuccess) { //Wait for EOS } else { test_is_true(false); disconnect(); } break; case PVT_COMMAND_STOP_PLAY: iStopPlayLCalled = false; if (aResponse.GetCmdStatus() == PVMFSuccess) { iAudioEOSRecv = false; iVideoEOSRecv = false; iCurrentRun++; if (iCurrentRun < iMaxRuns) { OSCL_TRY(error, terminal->StartPlayL()); if (error) { test_is_true(false); disconnect(); } } else { test_is_true(true); disconnect(); } } else { test_is_true(false); disconnect(); } break; } }
/* ///////////////////////////////////////////////////////////////////////// */ OSCL_EXPORT_REF TCVEI_RETVAL CPVM4VEncoder::Encode(TPVVideoInputData *aVidIn) { ULong modTime; VideoEncFrameIO vid_in; if (iState != EIdle || iObserver == NULL) { return ECVEI_FAIL; } if (aVidIn->iTimeStamp >= iNextModTime) { if (iVideoFormat == ECVEI_YUV420) #ifdef YUV_INPUT { if (iYUVIn) /* iSrcWidth is not multiple of 4 or iSrcHeight is odd number */ { CopyToYUVIn(aVidIn->iSource, iSrcWidth, iSrcHeight, ((iSrcWidth + 15) >> 4) << 4, ((iSrcHeight + 15) >> 4) << 4); iVideoIn = iYUVIn; } else /* otherwise, we can just use aVidIn->iSource */ { iVideoIn = aVidIn->iSource; } } #else return ECVEI_FAIL; #endif if ((iVideoFormat == ECVEI_RGB12) || (iVideoFormat == ECVEI_RGB24) || (iVideoFormat == ECVEI_YUV420SEMIPLANAR)) #if defined(RGB24_INPUT) || defined (RGB12_INPUT) || defined(YUV420SEMIPLANAR_INPUT) { ccRGBtoYUV->Convert(aVidIn->iSource, iYUVIn); iVideoIn = iYUVIn; } #else return ECVEI_FAIL; #endif /* assign with backward-P or B-Vop this timestamp must be re-ordered */ iTimeStamp = aVidIn->iTimeStamp; modTime = iTimeStamp; #ifdef NO_SLICE_ENCODE return ECVEI_FAIL; #else vid_in.height = ((iSrcHeight + 15) >> 4) << 4; vid_in.pitch = ((iSrcWidth + 15) >> 4) << 4; vid_in.timestamp = modTime; vid_in.yChan = (UChar*)iVideoIn; vid_in.uChan = (UChar*)(iVideoIn + vid_in.height * vid_in.pitch); vid_in.vChan = vid_in.uChan + ((vid_in.height * vid_in.pitch) >> 2); /*status = */ (int) PVEncodeFrameSet(&iEncoderControl, &vid_in, &modTime, &iNumLayer); #endif iState = EEncode; RunIfNotReady(); return ECVEI_SUCCESS; }
void pv_mediainput_async_test_delete::StartTest() { AddToScheduler(); iState = PVAE_CMD_CREATE; RunIfNotReady(); }
void OmxDecTestWithoutMarker::Run() { switch (iState) { case StateUnLoaded: { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateUnLoaded IN")); OMX_ERRORTYPE Err; OMX_BOOL Status; if (!iCallbacks->initCallbacks()) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - ERROR initCallbacks failed, OUT")); StopOnError(); break; } ipAppPriv = (AppPrivateType*) oscl_malloc(sizeof(AppPrivateType)); CHECK_MEM(ipAppPriv, "Component_Handle"); ipAppPriv->Handle = NULL; //Allocate bitstream buffer for AVC component if (0 == oscl_strcmp(iFormat, "H264")) { ipAVCBSO = OSCL_NEW(AVCBitstreamObject, (ipInputFile)); CHECK_MEM(ipAVCBSO, "Bitstream_Buffer"); } //Allocate bitstream buffer for MPEG4/H263 component if (0 == oscl_strcmp(iFormat, "M4V") || 0 == oscl_strcmp(iFormat, "H263")) { ipBitstreamBuffer = (OMX_U8*) oscl_malloc(BIT_BUFF_SIZE); CHECK_MEM(ipBitstreamBuffer, "Bitstream_Buffer") ipBitstreamBufferPointer = ipBitstreamBuffer; } iNoMarkerBitTest = OMX_TRUE; //This should be the first call to the component to load it. Err = OMX_MasterInit(); CHECK_ERROR(Err, "OMX_MasterInit"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - OMX_MasterInit done")); Status = PrepareComponent(); if (OMX_FALSE == Status) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() Error while loading component OUT")); iState = StateError; if (iInputParameters.inPtr) { oscl_free(iInputParameters.inPtr); iInputParameters.inPtr = NULL; } RunIfNotReady(); break; } #if PROXY_INTERFACE ipThreadSafeHandlerEventHandler = OSCL_NEW(OmxEventHandlerThreadSafeCallbackAO, (this, EVENT_HANDLER_QUEUE_DEPTH, "EventHandlerAO")); ipThreadSafeHandlerEmptyBufferDone = OSCL_NEW(OmxEmptyBufferDoneThreadSafeCallbackAO, (this, iInBufferCount, "EmptyBufferDoneAO")); ipThreadSafeHandlerFillBufferDone = OSCL_NEW(OmxFillBufferDoneThreadSafeCallbackAO, (this, iOutBufferCount, "FillBufferDoneAO")); if ((NULL == ipThreadSafeHandlerEventHandler) || (NULL == ipThreadSafeHandlerEmptyBufferDone) || (NULL == ipThreadSafeHandlerFillBufferDone)) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - Error ThreadSafe Callback Handler initialization failed, OUT")); iState = StateUnLoaded; OsclExecScheduler* sched = OsclExecScheduler::Current(); sched->StopScheduler(); } #endif if (StateError != iState) { iState = StateLoaded; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateUnLoaded OUT, moving to next state")); } RunIfNotReady(); } break; case StateLoaded: { OMX_ERRORTYPE Err; OMX_U32 ii; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateLoaded IN")); // allocate memory for ipInBuffer ipInBuffer = (OMX_BUFFERHEADERTYPE**) oscl_malloc(sizeof(OMX_BUFFERHEADERTYPE*) * iInBufferCount); CHECK_MEM(ipInBuffer, "InputBufferHeader"); ipInputAvail = (OMX_BOOL*) oscl_malloc(sizeof(OMX_BOOL) * iInBufferCount); CHECK_MEM(ipInputAvail, "InputBufferFlag"); /* Initialize all the buffers to NULL */ for (ii = 0; ii < iInBufferCount; ii++) { ipInBuffer[ii] = NULL; } //allocate memory for output buffer ipOutBuffer = (OMX_BUFFERHEADERTYPE**) oscl_malloc(sizeof(OMX_BUFFERHEADERTYPE*) * iOutBufferCount); CHECK_MEM(ipOutBuffer, "OutputBuffer"); ipOutReleased = (OMX_BOOL*) oscl_malloc(sizeof(OMX_BOOL) * iOutBufferCount); CHECK_MEM(ipOutReleased, "OutputBufferFlag"); /* Initialize all the buffers to NULL */ for (ii = 0; ii < iOutBufferCount; ii++) { ipOutBuffer[ii] = NULL; } Err = OMX_SendCommand(ipAppPriv->Handle, OMX_CommandStateSet, OMX_StateIdle, NULL); CHECK_ERROR(Err, "SendCommand Loaded->Idle"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Sent State Transition Command from Loaded->Idle")); iPendingCommands = 1; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Allocating %d input and %d output buffers", iInBufferCount, iOutBufferCount)); //These calls are required because the control of in & out buffer should be with the testapp. for (ii = 0; ii < iInBufferCount; ii++) { Err = OMX_AllocateBuffer(ipAppPriv->Handle, &ipInBuffer[ii], iInputPortIndex, NULL, iInBufferSize); CHECK_ERROR(Err, "AllocateBuffer_Input"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Called AllocateBuffer for buffer index %d on port %d", ii, iInputPortIndex)); ipInputAvail[ii] = OMX_TRUE; ipInBuffer[ii]->nInputPortIndex = iInputPortIndex; } if (StateError == iState) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - AllocateBuffer Error, StateLoaded OUT")); RunIfNotReady(); break; } for (ii = 0; ii < iOutBufferCount; ii++) { Err = OMX_AllocateBuffer(ipAppPriv->Handle, &ipOutBuffer[ii], iOutputPortIndex, NULL, iOutBufferSize); CHECK_ERROR(Err, "AllocateBuffer_Output"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Called AllocateBuffer for buffer index %d on port %d", ii, iOutputPortIndex)); ipOutReleased[ii] = OMX_TRUE; ipOutBuffer[ii]->nOutputPortIndex = iOutputPortIndex; ipOutBuffer[ii]->nInputPortIndex = 0; } if (StateError == iState) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - AllocateBuffer Error, StateLoaded OUT")); RunIfNotReady(); break; } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateLoaded OUT, Moving to next state")); } break; case StateIdle: { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateIdle IN")); OMX_ERRORTYPE Err = OMX_ErrorNone; /*Send an output buffer before dynamic reconfig */ Err = OMX_FillThisBuffer(ipAppPriv->Handle, ipOutBuffer[0]); CHECK_ERROR(Err, "FillThisBuffer"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - FillThisBuffer command called for initiating dynamic port reconfiguration")); ipOutReleased[0] = OMX_FALSE; Err = OMX_SendCommand(ipAppPriv->Handle, OMX_CommandStateSet, OMX_StateExecuting, NULL); CHECK_ERROR(Err, "SendCommand Idle->Executing"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Sent State Transition Command from Idle->Executing")); iPendingCommands = 1; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateIdle OUT")); } break; case StateDecodeHeader: { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateDecodeHeader IN, Sending configuration input buffers to the component to start dynamic port reconfiguration")); if (!iFlagDecodeHeader) { if (0 == oscl_strcmp(iFormat, "WMV") || 0 == oscl_strcmp(iFormat, "WMA") || 0 == oscl_strcmp(iFormat, "RV") || 0 == oscl_strcmp(iFormat, "RA")) { (*this.*pGetInputFrame)(); } else { GetInput(); } iFlagDecodeHeader = OMX_TRUE; //Proceed to executing state and if Port settings changed callback comes, //then do the dynamic port reconfiguration iState = StateExecuting; RunIfNotReady(); } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateDecodeHeader OUT")); } break; case StateDisablePort: { OMX_ERRORTYPE Err = OMX_ErrorNone; OMX_U32 ii; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateDisablePort IN")); if (!iDisableRun) { if (!iFlagDisablePort) { Err = OMX_SendCommand(ipAppPriv->Handle, OMX_CommandPortDisable, iOutputPortIndex, NULL); CHECK_ERROR(Err, "SendCommand_PortDisable"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Sent Command for OMX_CommandPortDisable on port %d as a part of dynamic port reconfiguration", iOutputPortIndex)); iPendingCommands = 1; iFlagDisablePort = OMX_TRUE; RunIfNotReady(); } else { //Wait for all the buffers to be returned on output port before freeing them //This wait is required because of the queueing delay in all the Callbacks for (ii = 0; ii < iOutBufferCount; ii++) { if (OMX_FALSE == ipOutReleased[ii]) { break; } } if (ii != iOutBufferCount) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Not all the output buffers returned by component yet, wait for it")); RunIfNotReady(); break; } for (ii = 0; ii < iOutBufferCount; ii++) { if (ipOutBuffer[ii]) { Err = OMX_FreeBuffer(ipAppPriv->Handle, iOutputPortIndex, ipOutBuffer[ii]); CHECK_ERROR(Err, "FreeBuffer_Output_DynamicReconfig"); ipOutBuffer[ii] = NULL; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Called FreeBuffer for buffer index %d on port %d", ii, iOutputPortIndex)); } } if (ipOutBuffer) { oscl_free(ipOutBuffer); ipOutBuffer = NULL; } if (ipOutReleased) { oscl_free(ipOutReleased); ipOutReleased = NULL; } if (StateError == iState) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - Error occured in this state, StateDisablePort OUT")); RunIfNotReady(); break; } iDisableRun = OMX_TRUE; } } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateDisablePort OUT")); } break; case StateDynamicReconfig: { OMX_BOOL Status = OMX_TRUE; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateDynamicReconfig IN")); Status = HandlePortReEnable(); if (OMX_FALSE == Status) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - Error occured in this state, StateDynamicReconfig OUT")); iState = StateError; RunIfNotReady(); break; } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateDynamicReconfig OUT")); } break; case StateExecuting: { OMX_U32 Index; OMX_BOOL MoreOutput; OMX_ERRORTYPE Err = OMX_ErrorNone; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateExecuting IN")); MoreOutput = OMX_TRUE; while (MoreOutput) { Index = 0; while (OMX_FALSE == ipOutReleased[Index] && Index < iOutBufferCount) { Index++; } if (Index != iOutBufferCount) { //This call is being made only once per frame Err = OMX_FillThisBuffer(ipAppPriv->Handle, ipOutBuffer[Index]); CHECK_ERROR(Err, "FillThisBuffer"); //Make this flag OMX_TRUE till u receive the callback for output buffer free ipOutReleased[Index] = OMX_FALSE; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - FillThisBuffer command called for output buffer index %d", Index)); } else { MoreOutput = OMX_FALSE; } } if (!iStopProcessingInput || (OMX_ErrorInsufficientResources == iStatusExecuting)) { if (0 == oscl_strcmp(iFormat, "WMV") || 0 == oscl_strcmp(iFormat, "WMA") || 0 == oscl_strcmp(iFormat, "RV") || 0 == oscl_strcmp(iFormat, "RA")) { iStatusExecuting = (*this.*pGetInputFrame)(); } else { iStatusExecuting = GetInput(); } } else if (OMX_FALSE == iEosFlagExecuting) { //Only send one successful dummy buffer with flag set to signal EOS Index = 0; while (OMX_FALSE == ipInputAvail[Index] && Index < iInBufferCount) { Index++; } if (Index != iInBufferCount) { ipInBuffer[Index]->nFlags |= OMX_BUFFERFLAG_EOS; ipInBuffer[Index]->nFilledLen = 0; Err = OMX_EmptyThisBuffer(ipAppPriv->Handle, ipInBuffer[Index]); CHECK_ERROR(Err, "EmptyThisBuffer_EOS"); ipInputAvail[Index] = OMX_FALSE; // mark unavailable iEosFlagExecuting = OMX_TRUE; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Input buffer sent to the component with OMX_BUFFERFLAG_EOS flag set")); } } else { //nothing to do here } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateExecuting OUT")); RunIfNotReady(); } break; case StateStopping: { OMX_ERRORTYPE Err = OMX_ErrorNone; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateStopping IN")); //stop execution by state transition to Idle state. if (!iFlagStopping) { Err = OMX_SendCommand(ipAppPriv->Handle, OMX_CommandStateSet, OMX_StateIdle, NULL); CHECK_ERROR(Err, "SendCommand Executing->Idle"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Sent State Transition Command from Executing->Idle")); iPendingCommands = 1; iFlagStopping = OMX_TRUE; } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateStopping OUT")); } break; case StateCleanUp: { OMX_U32 ii; OMX_ERRORTYPE Err = OMX_ErrorNone; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateCleanUp IN")); if (!iFlagCleanUp) { //Added a check here to verify whether all the ip/op buffers are returned back by the component or not //in case of Executing->Idle state transition if (OMX_FALSE == VerifyAllBuffersReturned()) { // not all buffers have been returned yet, reschedule RunIfNotReady(); break; } //Destroy the component by state transition to Loaded state Err = OMX_SendCommand(ipAppPriv->Handle, OMX_CommandStateSet, OMX_StateLoaded, NULL); CHECK_ERROR(Err, "SendCommand Idle->Loaded"); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Sent State Transition Command from Idle->Loaded")); iPendingCommands = 1; if (ipInBuffer) { for (ii = 0; ii < iInBufferCount; ii++) { if (ipInBuffer[ii]) { Err = OMX_FreeBuffer(ipAppPriv->Handle, iInputPortIndex, ipInBuffer[ii]); CHECK_ERROR(Err, "FreeBuffer_Input"); ipInBuffer[ii] = NULL; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Called FreeBuffer for buffer index %d on port %d", ii, iInputPortIndex)); } } oscl_free(ipInBuffer); ipInBuffer = NULL; } if (ipInputAvail) { oscl_free(ipInputAvail); ipInputAvail = NULL; } if (ipOutBuffer) { for (ii = 0; ii < iOutBufferCount; ii++) { if (ipOutBuffer[ii]) { Err = OMX_FreeBuffer(ipAppPriv->Handle, iOutputPortIndex, ipOutBuffer[ii]); CHECK_ERROR(Err, "FreeBuffer_Output"); ipOutBuffer[ii] = NULL; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Called FreeBuffer for buffer index %d on port %d", ii, iOutputPortIndex)); } } oscl_free(ipOutBuffer); ipOutBuffer = NULL; } if (ipOutReleased) { oscl_free(ipOutReleased); ipOutReleased = NULL; } iFlagCleanUp = OMX_TRUE; } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateCleanUp OUT")); } break; /********* FREE THE HANDLE & CLOSE FILES FOR THE COMPONENT ********/ case StateStop: { OMX_U8 TestName[] = "WITHOUT_MARKER_BIT_TEST"; OMX_ERRORTYPE Err = OMX_ErrorNone; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateStop IN")); if (ipAppPriv) { if (ipAppPriv->Handle) { PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Free the Component Handle")); Err = OMX_MasterFreeHandle(ipAppPriv->Handle); if (OMX_ErrorNone != Err) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - FreeHandle Error")); iTestStatus = OMX_FALSE; } } } PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - De-initialize the omx component")); Err = OMX_MasterDeinit(); if (OMX_ErrorNone != Err) { PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "OmxDecTestWithoutMarker::Run() - OMX_MasterDeinit Error")); iTestStatus = OMX_FALSE; } if (0 == oscl_strcmp(iFormat, "H264")) { if (ipAVCBSO) { OSCL_DELETE(ipAVCBSO); ipAVCBSO = NULL; } } if (0 == oscl_strcmp(iFormat, "M4V") || 0 == oscl_strcmp(iFormat, "H263")) { if (ipBitstreamBuffer) { oscl_free(ipBitstreamBufferPointer); ipBitstreamBuffer = NULL; ipBitstreamBufferPointer = NULL; } } if (iOutputParameters) { oscl_free(iOutputParameters); iOutputParameters = NULL; } if (ipAppPriv) { oscl_free(ipAppPriv); ipAppPriv = NULL; } #if PROXY_INTERFACE if (ipThreadSafeHandlerEventHandler) { OSCL_DELETE(ipThreadSafeHandlerEventHandler); ipThreadSafeHandlerEventHandler = NULL; } if (ipThreadSafeHandlerEmptyBufferDone) { OSCL_DELETE(ipThreadSafeHandlerEmptyBufferDone); ipThreadSafeHandlerEmptyBufferDone = NULL; } if (ipThreadSafeHandlerFillBufferDone) { OSCL_DELETE(ipThreadSafeHandlerFillBufferDone); ipThreadSafeHandlerFillBufferDone = NULL; } #endif VerifyOutput(TestName); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateStop OUT")); iState = StateUnLoaded; OsclExecScheduler* sched = OsclExecScheduler::Current(); sched->StopScheduler(); } break; case StateError: { //Do all the cleanup's and exit from here OMX_U32 ii; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateError IN")); iTestStatus = OMX_FALSE; if (ipInBuffer) { for (ii = 0; ii < iInBufferCount; ii++) { if (ipInBuffer[ii]) { OMX_FreeBuffer(ipAppPriv->Handle, iInputPortIndex, ipInBuffer[ii]); ipInBuffer[ii] = NULL; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Called FreeBuffer for buffer index %d on port %d", ii, iInputPortIndex)); } } oscl_free(ipInBuffer); ipInBuffer = NULL; } if (ipInputAvail) { oscl_free(ipInputAvail); ipInputAvail = NULL; } if (ipOutBuffer) { for (ii = 0; ii < iOutBufferCount; ii++) { if (ipOutBuffer[ii]) { OMX_FreeBuffer(ipAppPriv->Handle, iOutputPortIndex, ipOutBuffer[ii]); ipOutBuffer[ii] = NULL; PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG, (0, "OmxDecTestWithoutMarker::Run() - Called FreeBuffer for buffer index %d on port %d", ii, iOutputPortIndex)); } } oscl_free(ipOutBuffer); ipOutBuffer = NULL; } if (ipOutReleased) { oscl_free(ipOutReleased); ipOutReleased = NULL; } iState = StateStop; RunIfNotReady(); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_STACK_TRACE, (0, "OmxDecTestWithoutMarker::Run() - StateError OUT")); } break; default: { break; } } return ; }