Njutik
September 7th, 2009, 05:32 AM
Hello everybody!
I am writing my master thesis now and a part of my project deals with video/audio streaming. I tried a lot of things to solve my problem, but I didn't come any closer to the solution and hope very much, that you have the right idea.
The situation: on the one side I have a server (I use LIVE555MediaServer) which waits for incoming connections and streams videos on demand. On the other side I have a client application (self-made) which sends video-requests to the server. I manage to send all the necessary RTSP commands like OPTIONS, DESCRIBE, SETUP1, SETUP2, and PLAY. The server replies to all these messages in the right way and starts streaming the RTP pakets.
My client applicaiton waits for these RTP pakets and saves them to a file like video.mpg. At the end of the whole procedure there should be a .mpg file which can be played with a media player (I use the vlc).
My problem is, that despite the client applications manages to receive the RTP pakets and save them to a file ...mpg, the vlc either does not show any picture at all or shows only poor fragments of the video (see picture below).
I transfer the data via Ethernet. And as Ethernet can transmit packages with the size till 1500 Bytes I use the following command to receive one RTP package:
#define MAXSTRING 1500
char recvBuffer[MAXSTRING];
.
.
.
/*receiving the RTP pakets*/
if(FD_ISSET(RTP1Sock, &sockSet))
{
printf("RTP1 Paket vom Server\n");
if((recvBytes = recvfrom(RTP1Sock, recvBuffer, MAXSTRING, 0, (struct sockaddr *)&FromAddr, &FromAddrLen)) < 0)
{
DieWithError("Failed to receive an RTP1 paket");
}
recvBuffer[recvBytes] = '\0';
fwrite(&recvBuffer, sizeof(char), recvBytes, mpg);
paket_count++;
}
Does anybody see any mistake in that part of code, that could cause the problem?
It would be realy a huge help, if anybody could give me any advice.
Best wishes
Anna
I am writing my master thesis now and a part of my project deals with video/audio streaming. I tried a lot of things to solve my problem, but I didn't come any closer to the solution and hope very much, that you have the right idea.
The situation: on the one side I have a server (I use LIVE555MediaServer) which waits for incoming connections and streams videos on demand. On the other side I have a client application (self-made) which sends video-requests to the server. I manage to send all the necessary RTSP commands like OPTIONS, DESCRIBE, SETUP1, SETUP2, and PLAY. The server replies to all these messages in the right way and starts streaming the RTP pakets.
My client applicaiton waits for these RTP pakets and saves them to a file like video.mpg. At the end of the whole procedure there should be a .mpg file which can be played with a media player (I use the vlc).
My problem is, that despite the client applications manages to receive the RTP pakets and save them to a file ...mpg, the vlc either does not show any picture at all or shows only poor fragments of the video (see picture below).
I transfer the data via Ethernet. And as Ethernet can transmit packages with the size till 1500 Bytes I use the following command to receive one RTP package:
#define MAXSTRING 1500
char recvBuffer[MAXSTRING];
.
.
.
/*receiving the RTP pakets*/
if(FD_ISSET(RTP1Sock, &sockSet))
{
printf("RTP1 Paket vom Server\n");
if((recvBytes = recvfrom(RTP1Sock, recvBuffer, MAXSTRING, 0, (struct sockaddr *)&FromAddr, &FromAddrLen)) < 0)
{
DieWithError("Failed to receive an RTP1 paket");
}
recvBuffer[recvBytes] = '\0';
fwrite(&recvBuffer, sizeof(char), recvBytes, mpg);
paket_count++;
}
Does anybody see any mistake in that part of code, that could cause the problem?
It would be realy a huge help, if anybody could give me any advice.
Best wishes
Anna