PDA

View Full Version : NW Renderer: put_MaxTCPConnections failed



FS7
March 3, 2009, 14:12:18
Hi,

what is wrong? Below my code:

// Init
CComQIPtr<IMVNetworkRenderer4> pNWRenderer = m_pIFilterGraph->GetFilter( szFilter.AllocSysString() );

// Set Protocol
hr =pNWRenderer->put_Protocol(MV_NETWORK_PROTOCOL_TCP);
if( FAILED( hr ) ) {
strError.Format("(Error %x)", hr);
}

// Set Max TCPConnections
LONG lMaxTCPConnections=1;
hr =pNWRenderer->put_MaxTCPConnections(lMaxTCPConnections);
if( FAILED( hr ) ) {
strError.Format("(Error %x)", hr);
}


HRESULT = 80070057
->An invalid parameter was passed to the returning function

But i don't think so: The function expects LONG an passed LONG!

Best Regards
Fabian

Bernd Peretzke
March 3, 2009, 15:10:23
Hi

The invalid parameter means hat the parameter is out of range. The range for MaxTCPConnections is 1 to 999. Do you really pass 1 to this property or did you simlify the code for this post?

Regards
Bernd

FS7
March 3, 2009, 15:20:59
Hi,

no i pass 1 to this property!

Here is the entire code:

HRESULT CLocalCamera::setNWRendererSettings(CString szFilter, int iPort, CString strRemoteHost)
{
HRESULT hr = E_FAIL;

if(!m_pIFilterGraph)
return hr;

CString strError;
try
{
CComQIPtr<IMVNetworkRenderer4> pNWRenderer = m_pIFilterGraph->GetFilter( szFilter.AllocSysString() );

if(!pNWRenderer)
return hr;

hr =pNWRenderer->put_ClientAddress(strRemoteHost.AllocSysString());
if( FAILED( hr ) )
{
strError.Format("Port:%i; RemoteHost:%s; (Error %x)",PORT_VIDEO, strRemoteHost, hr);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - put_ClientAddress! " + strError);
return hr;
}
hr =pNWRenderer->put_Description(L"");
if( FAILED( hr ) )
{
strError.Format("Port:%i; RemoteHost:%s; (Error %x)",PORT_VIDEO, strRemoteHost, hr);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - put_Description! " + strError);
return hr;
}
hr =pNWRenderer->put_Port(iPort);
if( FAILED( hr ) )
{
strError.Format("Port:%i; RemoteHost:%s; (Error %x)",PORT_VIDEO, strRemoteHost, hr);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - put_Port! " + strError);
return hr;
}
hr =pNWRenderer->put_Protocol(MV_NETWORK_PROTOCOL_TCP);
if( FAILED( hr ) )
{
strError.Format("Port:%i; RemoteHost:%s; (Error %x)",PORT_VIDEO, strRemoteHost, hr);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - put_Protocol! " + strError);
return hr;
}
LONG lMaxTCPConnections=1;
hr =pNWRenderer->put_MaxTCPConnections(lMaxTCPConnections);
if( FAILED( hr ) )
{
strError.Format("Port:%i; RemoteHost:%s; (Error %x)",PORT_VIDEO, strRemoteHost, hr);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - put_MaxTCPConnections! " + strError);
return hr;
}
hr =pNWRenderer->UpdateNetworkConnection();
if( FAILED( hr ) )
{
strError.Format("Port:%i; RemoteHost:%s; (Error %x)",PORT_VIDEO, strRemoteHost, hr);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - UpdateNetworkConnection! " + strError);
return hr;
}

int status=0;
hr =pNWRenderer->get_Status(&status);
if( FAILED( hr ) )
{
strError.Format("RemoteHost:%s; (Error %x)", strRemoteHost, hr);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - get_Status! " + strError);
return hr;
}
pNWRenderer.Release();

switch(status)
{
case MV_NETWORK_STATUS_IDLE:
{
strError.Format("RemoteHost:%s; (Sends no network data from a server)", strRemoteHost);
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Kamera - get_Status! " + strError);
return E_FAIL;
}
break;
case MV_NETWORK_STATUS_SEND_MEDIATYPE:
strError.Format("RemoteHost:%s; (Sends mediatype information packets)", strRemoteHost);
CAISRemoteExperteApp::m_Log.WriteLine("[Info]\t [setNWRendererSettings]: Kamera - get_Status! " + strError);
break;
case MV_NETWORK_STATUS_SEND_STREAM:
strError.Format("RemoteHost:%s; (Sends media stream data and mediatype information packets)", strRemoteHost);
CAISRemoteExperteApp::m_Log.WriteLine("[Info]\t [setNWRendererSettings]: Kamera - get_Status! " + strError);
break;
default:
break;
}
}
catch( _com_error e )
{
strError.Format("(Exception: %X)", e.Error());
CAISRemoteExperteApp::m_Log.WriteLine("[Fehler]\t [setNWRendererSettings]: Video Komprimierung Setzen fehlgeschlagen! " + strError);
}

return hr;
}



Regards
Fabian

Bernd Peretzke
March 3, 2009, 15:41:17
Hi!

Ignore the return value. The filter always returns E_INVALIDARG. If the value within the range from 1 to 999 the filter accepts the value.

Regards
Bernd

FS7
March 3, 2009, 15:52:39
Thank you!