|
|
Hi, I have set up a Windows Server 2008 to broadcast a live multicast stream using the push method from another server that uses Windows Media Encoder 9.
It works when I use the standard UI, but when I try to use the Windows Media SDK and create the same push broadcast programmatically, the program hangs on the Encoder.Start() method.
Have anyone done this successfully??
My Initializing method for the encoding:
private void InitEncoder() { // Create a WMEncoder object. _encoder = new WMEncoder();
_encoder.OnSourceStateChange += new _IWMEncoderEvents_OnSourceStateChangeEventHandler(SrcChange); _encoder.OnAcquireCredentials += new _IWMEncoderEvents_OnAcquireCredentialsEventHandler(OnAcquireCredentials);
Debug.Write("Retrieve the source group collection.");
// Retrieve the source group collection. IWMEncSourceGroupCollection SrcGrpColl = _encoder.SourceGroupCollection;
Debug.Write("Add a source group to the collection."); // Add a source group to the collection. IWMEncSourceGroup2 SrcGrp = (IWMEncSourceGroup2)SrcGrpColl.Add("SG_1");
// Choose a profile from the collection. IWMEncProfileCollection ProColl = _encoder.ProfileCollection; IWMEncProfile Pro; for (int i = 0; i < ProColl.Count; i++) { Pro = ProColl.Item(i); //Debug.Write(Pro.Name); if (Pro.Name == "Windows Media Audio 8 for ISDN (Better than CD quality, 128 Kbps)") { SrcGrp.set_Profile(Pro); break; } }
IWMEncPushDistribution PushDist = (IWMEncPushDistribution)_encoder.Broadcast; PushDist.ServerName = "192.168.1.5"; IWMEncBroadcast Brdcst = _encoder.Broadcast; PushDist.PublishingPoint = "Test3"; Brdcst.set_PortNumber(WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_PUSH_DISTRIBUTION, 80); PushDist.AutoRemovePublishingPoint = true;
IWMEncSource SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO); SrcAud.SetInput(info.Filename, "", "");
//}
Debug.Write("\nPrepare to encode"); //_encoder.PrepareToEncode(true); Debug.Write("\nPrepare to encode finished"); _encoder.Start(); <-- hangs here Debug.Write("\nEncoding started"); <-- never gets to this line }
|
|
|