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)
OSCL_EXPORT_REF void PV2WayMIO::AddCompleted(const PVCmdResponse& aResponse)
{
    if (aResponse.GetCmdStatus() == PVMFSuccess)
    {
        iAdded = true;
    }
    else
    {
        OutputInfo("PV2WayMIO::AddCompleted:: Failed to add MIO");
        Closed();
    }

    iAddId = -1;
}
Пример #3
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 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;
    }
}
void PlayerDriver::CommandCompleted(const PVCmdResponse& aResponse)
{
    LOGV("CommandCompleted");
    int status = aResponse.GetCmdStatus();

    if (mDoLoop) {
        mDoLoop = false;
        RunIfNotReady();
        return;
    }

    PlayerCommand* ec = static_cast<PlayerCommand*>(aResponse.GetContext());
    LOGV("Command %d status=%d", ec ? ec->command(): 0, status);
    if (ec == NULL) return;

    // FIXME: Ignore non-fatal seek errors because pvPlayerEngine returns these errors and retains it's state.
    if (mSeekPending) {
        mSeekPending = false;
        if ( ( (status == PVMFErrArgument) || (status == PVMFErrInvalidState) || (status == PVMFErrNotSupported) ) ) {
            LOGV("Ignoring error during seek");
            status = PVMFSuccess;
        }
    }

    if (status == PVMFSuccess) {
        switch(ec->command()) {
        case PlayerCommand::PLAYER_PREPARE:
            LOGV("PLAYER_PREPARE complete mDownloadContextData=%p, mDataReadyReceived=%d", mDownloadContextData, mDataReadyReceived);
            mPrepareDone = true;
            // If we are streaming from the network, we
            // have to wait until the first PVMFInfoDataReady
            // is sent to notify the user that it is okay to
            // begin playback.  If it is a local file, just
            // send it now at the completion of Prepare().
            if ((mDownloadContextData == NULL) || mDataReadyReceived){
                mPvPlayer->sendEvent(MEDIA_PREPARED);
            }
            break;

        case PlayerCommand::PLAYER_GET_DURATION:
            handleGetDurationComplete(static_cast<PlayerGetDuration*>(ec));
            break;

        case PlayerCommand::PLAYER_PAUSE:
            LOGV("pause complete");
            break;

        case PlayerCommand::PLAYER_SEEK:
            mPvPlayer->sendEvent(MEDIA_SEEK_COMPLETE);
            break;

        default: /* shut up gcc */
            break;
        }

        // Call the user's requested completion function
        ec->complete(NO_ERROR, false);
    } else if (status == PVMFErrCancelled) {
        // Ignore cancelled command return status (PVMFErrCancelled), since it is not an error.
        LOGE("Command (%d) was cancelled", ec->command());
        status = PVMFSuccess;
        ec->complete(NO_ERROR, true);
    } else {  
        // error occurred
        if (status >= 0) status = -1;
        mPvPlayer->sendEvent(MEDIA_ERROR, status);
        ec->complete(UNKNOWN_ERROR, false);
    }

    delete ec;
}