Yesterday I had an idea how I could fix the last remaining problem in my udp multicast to tcp unicast proxy server (YAPS).
The last time I had to report this:
“There are some glitches I am afraid to say: one known bug is that there are 12 bytes to much in the outgoing data stream which corrupts the picture. If anyone here can fix it: Do it please ;) I tried one day and I could not find a solution for the problem.”
My idea was now, that those glitches are possibly there because some bytes of the header remain in each packet and therefore the movie stream itself is destroyed. MPlayer was able to display something, but as I said…glitches.
So I made a method that actually calculates the size of the header of each RTP packet and then removes this header:
1: public byte killRTPheader(byte b,ref int inlength)
3: byte outbytes = new byte;
4: int headersize = 12+4*((b >> 0) & 0x0f);
5: Array.ConstrainedCopy(b, headersize, outbytes, 0, inlength - headersize);
6: inlength = inlength - headersize;
7: return outbytes;
The results speak for themselves: A perfect sound and picture.
Beside that I added some additional features. Read the source and you’ll find out.
You can grab the source and binaries here: YAPS.zip (24,74 KB)