void testCreators() { MpMediaTask* pMediaTask = 0; OsStatus res; int numFramesAlready; // Call getMediaTask() which causes the task to get instantiated pMediaTask = MpMediaTask::getMediaTask(10); CPPUNIT_ASSERT(pMediaTask != NULL); // Check the initial state of the MpMediaTask object // **************************************************************************** // **** This is NOT THE INITIAL STATE UNLESS THE ABOVE CALL to getMediaTask() // **** is the very first call to that function. The problem with these // **** tests is that they were meant to be run separately, but that is not // **** the case with our self-starting singleton tasks. This one has been // **** around the track a few times already, we get whatever we get. // **************************************************************************** // Not anymore... CPPUNIT_ASSERT(pMediaTask->getDebugMode() == FALSE); // Good luck with the rest! CPPUNIT_ASSERT(pMediaTask->getFocus() == NULL); // Not anymore... CPPUNIT_ASSERT_EQUAL(0, pMediaTask->getLimitExceededCnt()); CPPUNIT_ASSERT(pMediaTask->getTimeLimit() == MpMediaTask::DEF_TIME_LIMIT_USECS); CPPUNIT_ASSERT(pMediaTask->getWaitTimeout() == MpMediaTask::DEF_SEM_WAIT_MSECS); // Not anymore... CPPUNIT_ASSERT_EQUAL(0, pMediaTask->getWaitTimeoutCnt()); CPPUNIT_ASSERT_EQUAL(0, pMediaTask->numManagedFlowGraphs()); // Not anymore... CPPUNIT_ASSERT_EQUAL(0, pMediaTask->numProcessedFrames()); numFramesAlready = pMediaTask->numProcessedFrames(); CPPUNIT_ASSERT_EQUAL(0, pMediaTask->numStartedFlowGraphs()); // Verify that the task is actually running by: // enabling debug mode // calling signalFrameStart() // checking the processed frame count res = pMediaTask->setDebug(TRUE); CPPUNIT_ASSERT(res == OS_SUCCESS); res = MpMediaTask::signalFrameStart(); // send a signal to the task CPPUNIT_ASSERT(res == OS_SUCCESS); // and give it a chance to run OsTask::delay(20); // Not anymore... CPPUNIT_ASSERT_EQUAL(1, pMediaTask->numProcessedFrames()); CPPUNIT_ASSERT_EQUAL((numFramesAlready+1), pMediaTask->numProcessedFrames()); }
// (static) Displays information on the console about the media processing // task. MpFlowGraphBase* MpMediaTask::mediaInfo(void) { MpFlowGraphBase* flowGraphs[20]; int i; int numItems; MpMediaTask* pMediaTask; MpFlowGraphBase* pFlowGraph; OsStatus res; pMediaTask = MpMediaTask::getMediaTask(0); printf("\nMedia processing task information\n"); printf(" Debug mode: %s\n", pMediaTask->getDebugMode() ? "TRUE" : "FALSE"); printf(" Processed Frame Count: %d\n", pMediaTask->numProcessedFrames()); printf(" Processing Time Limit: %d usecs\n", pMediaTask->getTimeLimit()); printf(" Processing Limit Exceeded Count: %d\n", pMediaTask->getLimitExceededCnt()); i = pMediaTask->getWaitTimeout(); if (i < 0) printf(" Frame Start Wait Timeout: INFINITE\n"); else printf(" Frame Start Wait Timeout: %d\n", i); printf(" Wait Timeout Exceeded Count: %d\n", pMediaTask->getWaitTimeoutCnt()); printf("\n Flow Graph Information\n"); printf(" Managed: %d\n", pMediaTask->numManagedFlowGraphs()); printf(" Started: %d\n", pMediaTask->numStartedFlowGraphs()); pFlowGraph = pMediaTask->getFocus(); if (pFlowGraph == NULL) printf(" Focus: NULL\n"); else printf(" Focus: %p\n", pFlowGraph); res = pMediaTask->getManagedFlowGraphs(flowGraphs, 20, numItems); for (i=0; i < numItems; i++) printf(" FlowGraph[%d]: %p\n", i, flowGraphs[i]); return pFlowGraph; }