[Live-devel] VLC uses Live555, UDP streaming out problem

Victor Lee victor_l2000 at hotmail.com
Wed Apr 25 19:43:28 PDT 2007


Hi Gurus,

I am trying to send a mytest.ts file (Transport Stream) via USP. I am doing 
this experiment on my
desktop, Windows XP. I did the following experiments:

Exp1: I used VLC 0.8.6a to read mytest.ts, streaming it out via UDP 
(unicast, set the ip address as my local computer, and a port #). I created 
a simple UDP server (see below) to receive
the stream and then save it into myfile.ts

mytest.ts and myfile.ts are different. VLC plays the original file mytest.ts 
well. But when using VLC to
play myfile.ts, there are blocks in the video.

Exp2: use VLc to read mytest.ts, and then streaming out via UDP, at the same 
time, output it to a file, myfile2.ts. Use another VLC to receive this 
stream (set the port # to 1234). The video received by the 2nd VLC does not 
have any problem and myfile2.ts does not have any problem.

I am wondering why using my application to receive the UDP stream and save 
into file has problem (the saved file does not need to be exactly the same 
as mytest.ts, as long as it plays well with VLC), but using VLC to save the 
file is ok, and using VLC to receive the UDP stream is also fine?

When using my simple application to receive the stream, each time i receive 
a 1316 bytes packet.
i can see the settings in the 1st VLC: Stream Output-->UDP as:
	Caching value(ms) 300
	Time-To-Live(TTL) 0
	Group packets 1

VLC uses live555, what changes happen in live555 for the process using VLC 
to stream the file out?

Thanks for your help!

Victor
-------------------------------
#include <winsock2.h>
#include <stdlib.h>
#include <stdio.h>

#define MAX_MSG 1316

int main()
{
	WSADATA wsaData;
	WORD wVersionRequested = MAKEWORD( 2, 2 );
	WSAStartup(wVersionRequested, &wsaData);

	int sd, rc, n, cliLen;
	struct sockaddr_in cliAddr, servAddr;
	char msg[MAX_MSG];

	sd = socket(AF_INET, SOCK_DGRAM, 0);

	if( sd < 0 )
	{
		exit(1);
	}

	servAddr.sin_family = AF_INET;
	servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
	servAddr.sin_port = htons(1234); //this is the port VLC used to streaming 
out mytest.ts with UDP

	rc = bind (sd, (struct sockaddr *) &servAddr, sizeof(servAddr));

	if ( rc < 0 )
	{
		exit(1);
	}

	FILE *fp = fopen("myfile.ts", "wb");

	cliLen = sizeof(cliAddr);
	while(1)
	{
		memset(msg, 0x0, MAX_MSG);
		n = recvfrom(sd, msg, MAX_MSG, 0, (struct sockaddr *) &cliAddr, &cliLen);
		if(n<0)
		{
			exit(-1);
		}
		fwrite(msg, n, sizeof(char), fp);
	}
	fclose(fp);
	WSACleanup();
	return 0;
}

_________________________________________________________________
Mortgage rates near historic lows. Refinance $200,000 loan for as low as 
$771/month* 
https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h27f8&disc=y&vers=689&s=4056&p=5117



More information about the live-devel mailing list