Esempio n. 1
0
bool ServerManager::Tick( )
{
	bool ret;

	ret = Select( );
	if(!ret)
	{
		g_pLog->log_debug("%u,%u,Select Faild",0,0);
	}

	ret = ProcessExceptions( );
	if(!ret)
	{
		g_pLog->log_debug("%u,%u,ProcessExceptions Faild",0,0);
	}

	ret = ProcessInputs( );
	if(!ret)
	{
		g_pLog->log_debug("%u,%u,ProcessInputs Faild",0,0);
	}

	ret = ProcessOutputs( );
	if(!ret)
	{
		g_pLog->log_debug("%u,%u,ProcessOutputs Faild",0,0);
	}

	ret = ProcessCommands( );
	if(!ret)
	{
		g_pLog->log_debug("%u,%u,ProcessCommands Faild",0,0);
	}

	ret = ProcessCacheCommands( );
	if(!ret)
	{
		g_pLog->log_debug("%u,%u,ProcessCacheCommands Faild",0,0);
	}

	ret = HeartBeat( );
	if(!ret)
	{
		g_pLog->log_debug("%u,%u,HeartBeat Faild",0,0);
	}

	//ret = SendQueuePlayerToWorld( );
	
	return true;
}
Esempio n. 2
0
HRESULT CAppStream::Stream( BYTE **ppbOutData, ULONG *pbDataSize, LPWAVEFORMATEX *ppwfx )
{
    HRESULT         hr = S_OK;
    BYTE            *pOut;

    *pbDataSize     = m_uDataSize;
    *ppwfx          = m_pwfx;

    if ( m_pObjectInPlace ){

        pOut = new BYTE [m_uDataSize];

        if( pOut == 0 ){
            return E_OUTOFMEMORY;
        }
        CopyMemory(pOut, m_pbInData, m_uDataSize);

        // pass the number of samples to Process()
        hr = m_pObjectInPlace->Process( m_uDataSize,
                                        pOut,
                                        0,
                                        DMO_INPLACE_NORMAL);
        if( FAILED( hr ) ){
            return hr;
        }
        *ppbOutData = pOut;
        SAFE_RELEASE( m_pObjectInPlace );
    }
    else
    {
        CMediaBuffer            *pInputBuffer;
        const REFERENCE_TIME    rtStart     = 0;
        const REFERENCE_TIME    rtStop      = 0;
        BYTE*                   pBuffer;
        DWORD                   dwLength;

        // create and fill CMediaBuffer
        hr = CreateBuffer(m_uDataSize, &pInputBuffer);
        if( FAILED( hr ) ){
            return hr;
        }

        hr = pInputBuffer->GetBufferAndLength( &pBuffer, &dwLength );
        if( FAILED( hr ) ){
            return hr;
        }
        CopyMemory(pBuffer, m_pbInData, m_uDataSize);

        hr = pInputBuffer->SetLength( m_uDataSize );
        if( FAILED( hr ) ){
            return hr;
        }

        // call processInput
        hr = m_pObject->ProcessInput( 0,
                                pInputBuffer,
                                DMO_INPUT_DATA_BUFFERF_SYNCPOINT,
                                rtStart,
                                rtStop - rtStart);
        if( FAILED( hr ) ){
            return hr;
        }

        //release input buffer
        SAFE_RELEASE( pInputBuffer );

        // retrieve the output data from DMO and put into pOut
        if(S_FALSE == hr){
            return E_FAIL;
        } else {
            pOut = NULL;
            hr = ProcessOutputs( &pOut );
            if( FAILED( hr ) ){
                delete [] pOut;
                return hr;
            }
        }

        *ppbOutData = pOut;
        SAFE_RELEASE( m_pObject );
    }

    return S_OK;
}