Exemplo n.º 1
0
bool MetadataDriver::isCommandSuccessful(const PVCmdResponse& aResponse) const
{
    LOGV("isCommandSuccessful");
    bool success = ((aResponse.GetCmdId() == mCmdId) &&
            (aResponse.GetCmdStatus() == PVMFSuccess) &&
            (aResponse.GetContext() == (OsclAny*)&mContextObject));
    if (!success) {
        LOGE("isCommandSuccessful: Command id(%d and expected %d) and status (%d and expected %d), data corruption (%s) at state (%d).",
             aResponse.GetCmdId(), mCmdId, aResponse.GetCmdStatus(), PVMFSuccess, (aResponse.GetContext() == (OsclAny*)&mContextObject)? "false": "true", mState);
    }
    return success;
}
void test_base::CommandCompleted(const PVCmdResponse& aResponse)
{
    PVCommandId cmdId = aResponse.GetCmdId();
    if (cmdId < 0)
        return;
    iTestStatus &= (aResponse.GetCmdStatus() == PVMFSuccess) ? true : false;

    if (iQueryInterfaceCmdId == cmdId)
    {
        if (aResponse.GetCmdStatus() == PVMFSuccess)
        {
            if (iTempH324MConfigIterface)
            {
                /*!

                  Step 6: Finish Querying Component

                  Step 6a: Receive notification that TSC node interface pointer has been set.
                  At this point we are notified that the TSC node interface pointer is valid.
                  Convert the pointer to H324MConfigInterface
                */
                iH324MConfig = OSCL_STATIC_CAST(H324MConfigInterface*, iTempH324MConfigIterface);
                iH324MConfig->addRef();
                iTempH324MConfigIterface->removeRef();
                iTempH324MConfigIterface = NULL;
                QueryInterfaceSucceeded();
            }

        }
    }
    else if (iInitCmdId == cmdId)
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;
    }
}