// Clean up after test is done. void MpGenericResourceTest::tearDown() { OsStatus res; // This should normally be done by haltFramework, but if we aborted due // to an assertion the flowgraph will need to be shutdown here if(mpFlowGraph && mpFlowGraph->isStarted()) { printf("WARNING: flowgraph found still running, shutting down\n"); // ignore the result and keep going mpFlowGraph->stop(); // Request processing of another frame so that the STOP_FLOWGRAPH // message gets handled mpFlowGraph->processNextFrame(); } // Free flowgraph resources delete mpFlowGraph; mpFlowGraph = NULL; mpSinkResource = NULL; mpSourceResource = NULL; // Clear all Media Tasks data res = mpShutdown(); CPPUNIT_ASSERT(res == OS_SUCCESS); }
// Initialize test framework void MpGenericResourceTest::setUp() { // Just in case the test aborted without doing a shut down, try to shut things down OsStatus res = mpShutdown(); MpMediaTask* pMediaTask = NULL; // Setup codec paths.. UtlString codecPaths[] = { #ifdef WIN32 "bin", "..\\bin", #elif __pingtel_on_posix__ "../../../../bin", "../../../bin", #else # error "Unknown platform" #endif "." }; int numCodecPaths = sizeof(codecPaths)/sizeof(codecPaths[0]); // Setup media task res = mpStartUp(mSamplesPerSec, mSamplesPerFrame, 512, NULL, numCodecPaths, codecPaths); CPPUNIT_ASSERT(res == OS_SUCCESS); mpFlowGraph = new MpFlowGraphBase(mSamplesPerFrame, mSamplesPerSec); CPPUNIT_ASSERT(mpFlowGraph != NULL); // Create MediaTask pMediaTask = MpMediaTask::createMediaTask(10); CPPUNIT_ASSERT(pMediaTask != NULL); }
OsStatus mpStopTasks(void) { mpShutdown(); shutdownNetInTask(); dmaShutdown(); return OS_SUCCESS; }
// Destructor sipXmediaFactoryImpl::~sipXmediaFactoryImpl() { // TODO: Shutdown --miInstanceCount; if (miInstanceCount == 0) { // Temporarily comment out this function because it causes the program hung. mpStopTasks(); mpShutdown(); } }
// Destructor sipXmediaFactoryImpl::~sipXmediaFactoryImpl() { OsSysLog::add(FAC_MP, PRI_DEBUG, "~sipXmediaFactoryImpl miInstanceCount: %d\n", miInstanceCount); // TODO: Shutdown --miInstanceCount; if (miInstanceCount == 0) { #ifndef ENABLE_TOPOLOGY_FLOWGRAPH_INTERFACE_FACTORY mpStopTasks(); #else NetInTask *pTask = NetInTask::getNetInTask(); pTask->destroy(); #endif mpShutdown(); } }
// This function will be called after every test to clean up framework. void tearDown() { // This should normally be done by haltFramework, but if we aborted due // to an assertion the flowgraph will need to be shutdown here if (mpFlowGraph && mpFlowGraph->isStarted()) { //osPrintf("WARNING: flowgraph found still running, shutting down\n"); // ignore the result and keep going mpFlowGraph->stop(); // Request processing of another frame so that the STOP_FLOWGRAPH // message gets handled mpFlowGraph->processNextFrame(); } // Free flowgraph delete mpFlowGraph; mpFlowGraph = NULL; // Clear all media processing data and delete MpMediaTask instance. CPPUNIT_ASSERT_EQUAL(OS_SUCCESS, mpShutdown()); }