locked
problem with topology using aggregated source RRS feed

  • Question

  • I use the following code to create a topology for parallel audio and video capturing using an aggregated source. When I call IMFMediaSession::Start() I receive E_INVALIDARGUMENT as result of the MESessionStarted event.

    The components (device sources, encoders and sinks) themselves are configured correctly since capturing using a topology created using either audio or video source directly works fine.

     

    IMFTopology * CreateTopology(IMFMediaSource *pSource, IMFPresentationDescriptor *pSourcePD, IMFStreamDescriptor *pVideoSourceSD, IMFTransform *pVideoEncoder, IMFStreamSink *pVideoSink, IMFStreamDescriptor *pAudioSourceSD, IMFTransform *pAudioEncoder, IMFStreamSink *pAudioSink)
    {
    	IMFTopology *pTopology = NULL;
    	CHECK_HR(MFCreateTopology(&pTopology));
    
    	//video source node
    	IMFTopologyNode *pVideoSourceNode = NULL;
    	CHECK_HR(MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &pVideoSourceNode));
    	CHECK_HR(pVideoSourceNode->SetUnknown(MF_TOPONODE_SOURCE, pSource));
    	CHECK_HR(pVideoSourceNode->SetUnknown(MF_TOPONODE_PRESENTATION_DESCRIPTOR, pSourcePD));
    	CHECK_HR(pVideoSourceNode->SetUnknown(MF_TOPONODE_STREAM_DESCRIPTOR, pVideoSourceSD));
    
    	CHECK_HR(pTopology->AddNode(pVideoSourceNode));
    
    	//video encoder node
    	IMFTopologyNode *pVideoEncoderNode = NULL;
    	CHECK_HR(MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &pVideoEncoderNode));
    	CHECK_HR(pVideoEncoderNode->SetObject(pVideoEncoder));
    
    	CHECK_HR(pTopology->AddNode(pVideoEncoderNode));
    	CHECK_HR(pVideoSourceNode->ConnectOutput(0, pVideoEncoderNode, 0));
    
    	//video sink node
    	IMFTopologyNode *pVideoSinkNode = NULL;
    	CHECK_HR(MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &pVideoSinkNode));
    	CHECK_HR(pVideoSinkNode->SetObject(pVideoSink));
    
    	CHECK_HR(pTopology->AddNode(pVideoSinkNode));
    	CHECK_HR(pVideoEncoderNode->ConnectOutput(0, pVideoSinkNode, 0));
    
    	//audio source node
    	IMFTopologyNode *pAudioSourceNode = NULL;
    	CHECK_HR(MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &pAudioSourceNode));
    	CHECK_HR(pAudioSourceNode->SetUnknown(MF_TOPONODE_SOURCE, pSource));
    	CHECK_HR(pAudioSourceNode->SetUnknown(MF_TOPONODE_PRESENTATION_DESCRIPTOR, pSourcePD));
    	CHECK_HR(pAudioSourceNode->SetUnknown(MF_TOPONODE_STREAM_DESCRIPTOR, pAudioSourceSD));
    
    	CHECK_HR(pTopology->AddNode(pAudioSourceNode));
    
    	//audio encoder node
    	IMFTopologyNode *pAudioEncoderNode = NULL;
    	CHECK_HR(MFCreateTopologyNode(MF_TOPOLOGY_TRANSFORM_NODE, &pAudioEncoderNode));
    	CHECK_HR(pAudioEncoderNode->SetObject(pAudioEncoder));
    
    	CHECK_HR(pTopology->AddNode(pAudioEncoderNode));
    	CHECK_HR(pAudioSourceNode->ConnectOutput(0, pAudioEncoderNode, 0));
    
    	//audio sink node
    	IMFTopologyNode *pAudioSinkNode = NULL;
    	CHECK_HR(MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &pAudioSinkNode));
    	CHECK_HR(pAudioSinkNode->SetObject(pAudioSink));
    
    	CHECK_HR(pTopology->AddNode(pAudioSinkNode));
    	CHECK_HR(pAudioEncoderNode->ConnectOutput(0, pAudioSinkNode, 0));
    
    	return pTopology;
    }
    
    Any ideas?

     

    Monday, March 29, 2010 1:45 PM

Answers

  • I already solved the problem.

    I tried to use the StreamDescriptors that I received from the Audio/Video sources. I now retrieve the StreamDescriptors from the aggregated source and it works.

    Monday, April 12, 2010 12:17 PM

All replies

  • I do not think I have enough information here to locate the issue.  To clarify, pVideoSourceSD and pAudioSourceSD came from pSourcePD->GetStreamDescriptorByIndex, and pSourcePD came from pSource->CreatePresentationDescriptor?  Are pAudioSink and pVideoSink different stream sinks on the same media sink?
    Tuesday, April 6, 2010 6:29 PM
  • I already solved the problem.

    I tried to use the StreamDescriptors that I received from the Audio/Video sources. I now retrieve the StreamDescriptors from the aggregated source and it works.

    Monday, April 12, 2010 12:17 PM