I'm using VLM from a VB.NET (VS2005 with .NET Framework 2.0) application and wonder about a strange behavior. Here's a code example where you can see the problem.
Code: Select all
'/ variables
Dim _host As String = "192.168.1.1"
Dim _port As String = "4212"
Dim _TcpClient As System.Net.Sockets.TcpClient
Dim _NetStream As System.Net.Sockets.NetworkStream
Dim _StreamWriter As System.IO.StreamWriter
Dim _StreamReader As System.IO.StreamReader
'/ open connection to server
_TcpClient = New System.Net.Sockets.TcpClient()
_TcpClient.Connect(_host, _port)
'/ using stream of socket connection
_NetStream = _TcpClient.GetStream()
_StreamReader = New System.IO.StreamReader(_NetStream, System.Text.Encoding.ASCII)
_StreamWriter = New System.IO.StreamWriter(_NetStream, System.Text.Encoding.ASCII)
_StreamWriter.AutoFlush = True
'/ setting timeout value
_NetStream.ReadTimeout = 2000
'/ sending the correct password
_StreamWriter.WriteLine("admin")
'/ read away the first line (it is the one with the password)
_StreamReader.ReadLine()
'/ test if I get the correct welcome-message back
If Not _StreamReader.ReadLine().StartsWith("Welcome, Master") Then
Throw New Exception("RZSTREAM is answering but with wrong welcomemessage.")
End If
'/ creating a VLM-stream
_StreamWriter.WriteLine("new mainstream broadcast")
_StreamWriter.WriteLine("setup mainstream input dshow://")
_StreamWriter.WriteLine("setup mainstream option dshow-vdev=Capture1")
_StreamWriter.WriteLine("setup mainstream option dshow-adev=none")
_StreamWriter.WriteLine("setup mainstream option dshow-size=")
_StreamWriter.WriteLine("setup mainstream output #transcode{vcodec=WMV2,vb=512,scale=1}:duplicate{dst=std{access=mmsh,mux=asfh,url=:1234}}")
_StreamWriter.WriteLine("setup mainstream enabled")
_StreamWriter.WriteLine("control mainstream play")
'/ workaround for VLC-Bug?!
Threading.Thread.Sleep(3000)
_StreamReader.ReadLine()
'/ close connection
_StreamReader.Close()
_StreamWriter.Close()
_NetStream.Close()
_TcpClient.Close()
The critical part are the two rows from, what I called, "workaround for VLC-Bug?!"
If I don't have them both, the stream will start correctly, but the CPU of vlc.exe raises to 99% and never goes down again! The stream I started works well, but you can'T use the system and especially VLC in a normal way anymore. You can't for example start another job over VLM which saves this stream to a file. This file will be crippled
I've tested three versions:
0.8.4a, a nightly build from 15th february and one from 7th march.
The first two show the same behavior. If I wait three seconds and then do a ReadLine again, everything works. The programm finishes and the stream is running correctly.
With todays nightly build, the behavior of VLC is a little bit different. My program thrwos an execption, because it can't do the readline of the "workaround" part anymore, because there doesn't seem to be any data now. And just after confirming the error message box, I can see the cpu-load of VLC going up to 99% again!
When using the Telnet-Interface by hand, everything works as planned, so I guess my programm is doing something wrong. Something wrong, that leads to a hang of VLC!
I don't think this kind of behavior is wanted!
Greetings,
Dominik