Exemplo n.º 1
0
    void testFocus()
    {
        MpFlowGraphBase* pFlowGraph = 0;
        MpMediaTask*     pMediaTask = 0;
        OsStatus         res;

        // Test 1: Attempt to setFocus to a flow graph that the media task
        //         is not managing
        pMediaTask = MpMediaTask::getMediaTask(10);
        pFlowGraph = new MpFlowGraphBase(30, 30);
        res = pMediaTask->setFocus(pFlowGraph); // send the media task a
        CPPUNIT_ASSERT(res == OS_SUCCESS);      // set_focus command and
        res = MpMediaTask::signalFrameStart();  // give it a chance to run
        CPPUNIT_ASSERT(res == OS_SUCCESS);
        OsTask::delay(20);

        CPPUNIT_ASSERT_EQUAL(1, pMediaTask->numHandledMsgErrs());

        // Test 2: Set the focus to a flow graph that has not been started
        res = pMediaTask->manageFlowGraph(*pFlowGraph);
        CPPUNIT_ASSERT(res == OS_SUCCESS);      // manage the flow graph and
        res = pMediaTask->setFocus(pFlowGraph); // send the media task a
        CPPUNIT_ASSERT(res == OS_SUCCESS);      // set_focus command and
        res = MpMediaTask::signalFrameStart();  // give it a chance to run
        CPPUNIT_ASSERT(res == OS_SUCCESS);
        OsTask::delay(20);
        CPPUNIT_ASSERT_EQUAL(1, pMediaTask->numHandledMsgErrs());

        // Test 3: Set the focus to a flow graph that has been started
        res = pMediaTask->startFlowGraph(*pFlowGraph);
        CPPUNIT_ASSERT(res == OS_SUCCESS);      // start the flow graph and
        res = pMediaTask->setFocus(pFlowGraph); // send the media task a
        CPPUNIT_ASSERT(res == OS_SUCCESS);      // set_focus command and
        res = MpMediaTask::signalFrameStart();  // give it a chance to run
        CPPUNIT_ASSERT(res == OS_SUCCESS);
        OsTask::delay(20);

        // 6/16/99, incompatible with new, real implementation of Focus:
        // CPPUNIT_ASSERT(pMediaTask->getFocus() == pFlowGraph);

        // Test 4: Set the focus to NULL
        res = pMediaTask->unmanageFlowGraph(*pFlowGraph);
        CPPUNIT_ASSERT(res == OS_SUCCESS);      // unmanage the flow graph
        res = pMediaTask->setFocus(NULL);       // and send the media task a
        CPPUNIT_ASSERT(res == OS_SUCCESS);      // set_focus command and
        res = MpMediaTask::signalFrameStart();  // give it a chance to run
        CPPUNIT_ASSERT(res == OS_SUCCESS);
        CPPUNIT_ASSERT(pMediaTask->getFocus() == NULL);

        delete pFlowGraph;
    }
Exemplo n.º 2
0
OsStatus CpPhoneMediaInterface::giveFocus()
{
    if(mpFlowGraph)
    {
        // There should probably be a lock here
        // Set the flow graph to have the focus
        MpMediaTask* mediaTask = MpMediaTask::getMediaTask(0);
        mediaTask->setFocus(mpFlowGraph);
        // osPrintf("Setting focus for flow graph\n");
   }

   return OS_SUCCESS ;
}
Exemplo n.º 3
0
OsStatus CpPhoneMediaInterface::defocus()
{
    if(mpFlowGraph)
    {
        MpMediaTask* mediaTask = MpMediaTask::getMediaTask(0);

        // There should probably be a lock here
        // take focus away from the flow graph if it is focus
        if(mpFlowGraph == (MpCallFlowGraph*) mediaTask->getFocus())
        {
            mediaTask->setFocus(NULL);
            // osPrintf("Setting NULL focus for flow graph\n");
        }
    }
    return OS_SUCCESS ;
}
Exemplo n.º 4
0
// Destructor
CpPhoneMediaInterface::~CpPhoneMediaInterface()
{
   OsSysLog::add(FAC_CP, PRI_DEBUG, "CpPhoneMediaInterface::~CpPhoneMediaInterface deleting the CpMediaInterface %p",
                 this);

    CpPhoneMediaConnection* mediaConnection = NULL;
    while ((mediaConnection = (CpPhoneMediaConnection*) mMediaConnections.get()))
    {
        doDeleteConnection(mediaConnection);
        delete mediaConnection;
        mediaConnection = NULL;
    }

    if(mpFlowGraph)
    {
        // Free up the resources used by tone generation ASAP
        stopTone();

        // Stop the net in/out stuff before the sockets are deleted
        //mpMediaFlowGraph->stopReceiveRtp();
        //mpMediaFlowGraph->stopSendRtp();

        MpMediaTask* mediaTask = MpMediaTask::getMediaTask(0);

        // take focus away from the flow graph if it is focus
        if(mpFlowGraph == (MpCallFlowGraph*) mediaTask->getFocus())
        {
            mediaTask->setFocus(NULL);
        }

        OsSysLog::add(FAC_CP, PRI_DEBUG, "CpPhoneMediaInterface::~CpPhoneMediaInterface deleting the MpCallFlowGraph %p",
                      mpFlowGraph);
        delete mpFlowGraph;
        mpFlowGraph = NULL;
    }
}