0

I modified the live555 source code where sendto function locate.

I add a multicast after sendto function.

int bytesSent = sendto(socket, (char*)buffer, bufferSize, 0, (struct sockaddr*)&dest, sizeof dest); 
//zhouhua add below 
if(zhou_init == 0){ 
    zhou_init = 1; 
    memset(&mcast_addr,0,sizeof(mcast_addr)); 
    mcast_addr.sin_family = AF_INET; 
    mcast_addr.sin_addr.s_addr = inet_addr("224.0.0.251"); 
    mcast_addr.sin_port = htons(5004); 
}
int k = sendto(socket, (char*)buffer, bufferSize,0,(struct sockaddr*)&mcast_addr, sizeof(mcast_addr)); 
printf("k = %d\n", k); 
//zhou end 

It works when I play the rtsp stream. When I play a sdp file, it plays the multicast video.

But, on win7, I can't get any response with vlc player.

While wireshark get the same multicast data on win7 and ubuntu.

Why it not work on win7 ?

mpromonet
  • 11,326
  • 43
  • 62
  • 91
Zhou
  • 1
  • just download it from http://live555.com/liveMedia/public/ and the key code is as below: – Zhou Aug 24 '15 at 03:29
  • `code`int bytesSent = sendto(socket, (char*)buffer, bufferSize, 0, (struct sockaddr*)&dest, sizeof dest); //zhouhua add below if(zhou_init == 0){ zhou_init = 1; memset(&mcast_addr,0,sizeof(mcast_addr)); mcast_addr.sin_family = AF_INET; mcast_addr.sin_addr.s_addr = inet_addr("224.0.0.251"); mcast_addr.sin_port = htons(5004); int k = sendto(socket, (char*)buffer, bufferSize,0,(struct sockaddr*)&mcast_addr, sizeof(mcast_addr)); printf("k = %d\n", k); //zhou end `code`@zed – Zhou Aug 24 '15 at 03:30
  • god... I dont know how to use this code format... – Zhou Aug 24 '15 at 03:37
  • and now, I found vmware host can multicast with vmware host, but real host can't muliticast with wmware host. and real to real can not ,either. – Zhou Aug 24 '15 at 09:53
  • Add the code to the question, not a comment – SilverCorvus Oct 20 '15 at 10:24
  • @Zhou I copy the code you gave in comments in the post (adding a curly brace that seems missing. If I made mistake please fix it. Could you add the SDP file used to play the stream with VLC ? – mpromonet Oct 21 '15 at 05:48

1 Answers1

0

i'v found it .I should change the sdp file. the IP parameter should write int the end of the file.

Zhou
  • 1