[Live-devel] (no subject)

julien.savarese at dcnsgroup.com julien.savarese at dcnsgroup.com
Tue May 13 01:23:57 PDT 2008


hello,

thanks for your great responce, I have change my route like this : 
destination : 255.255.0.0   mask : 255.255.255.0 gateway : 192.168.0.254, 
my workstation IP is 192.168.0.2.

but I have a other probleme, i try to read the file trasnmit with 
testMPEG1or2VideoStreamer with vlc , in udp with the port 1234.

I just want use the RTP protocole, and don't have a serveur RSTP, so I 
erased the part of code I think is useless for simple RTP streming, but I 
must be wrong, because VLC cannot read this rtp stream, the error :" main 
private error : cannot prefill buffer" is in VLC.

can you say me if the modified code is correct ???

I am not sure that  Groupsock rtcpGroupsock(*env, destinationAddress, 
rtcpPort, ttl) is usefull...

there is the code modified : 
/**********
This library is free software; you can redistribute it and/or modify it 
under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version. (See 
<http://www.gnu.org/copyleft/lesser.html>.)

This library is distributed in the hope that it will be useful, but 
WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
more details.

You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, 
Inc.,
59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
**********/
// Copyright (c) 1996-2007, Live Networks, Inc.  All rights reserved
// A test program that reads a MPEG-1 or 2 Video Elementary Stream file,
// and streams it using RTP
// main program

#include "liveMedia.hh"
#include "BasicUsageEnvironment.hh"
#include "GroupsockHelper.hh"

// Uncomment the following if the input file is a MPEG Program Stream
// rather than a MPEG Video Elementary Stream
#define SOURCE_IS_PROGRAM_STREAM 1

// To stream using "source-specific multicast" (SSM), uncomment the 
following:
//#define USE_SSM 1
#ifdef USE_SSM
Boolean const isSSM = True;
#else
Boolean const isSSM = False;
#endif


// To set up an internal RTSP server, uncomment the following:
//#define IMPLEMENT_RTSP_SERVER 1
// (Note that this RTSP server works for multicast only)

// To stream *only* MPEG "I" frames (e.g., to reduce network bandwidth),
// change the following "False" to "True":
Boolean iFramesOnly = True;

UsageEnvironment* env;
char const* inputFileName = "test.mpg";
//char const* inputFileName = "/dev/video";
#ifdef SOURCE_IS_PROGRAM_STREAM
MPEG1or2Demux* mpegDemux;
#endif
MediaSource* videoSource;
RTPSink* videoSink;

void play(); // forward

int main(int argc, char** argv) {


 
  // Begin by setting up our usage environment:
  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
  env = BasicUsageEnvironment::createNew(*scheduler);

  // Create 'groupsocks' for RTP and RTCP:
  char* destinationAddressStr
#ifdef USE_SSM
    = "192.168.0.1";
#else
    = "192.168.0.1";
  // Note: This is a multicast address.  If you wish to stream using
  // unicast instead, then replace this string with the unicast address
  // of the (single) destination.  (You may also need to make a similar
  // change to the receiver program.)
#endif
  const unsigned short rtpPortNum = 1234;
 // const unsigned short rtpPortNum = 8888;
  const unsigned short rtcpPortNum = rtpPortNum+1;
  const unsigned char ttl = 1; // low, in case routers don't admin scope

  struct in_addr destinationAddress;
 destinationAddress.s_addr = our_inet_addr(destinationAddressStr);

  const Port rtpPort(rtpPortNum);
  const Port rtcpPort(rtcpPortNum);

  Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
  Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);

#ifdef USE_SSM
  rtpGroupsock.multicastSendOnly();
  rtcpGroupsock.multicastSendOnly();
#endif

  // Create a 'MPEG Video RTP' sink from the RTP 'groupsock':
  videoSink = MPEG1or2VideoRTPSink::createNew(*env, &rtpGroupsock);

  // Create (and start) a 'RTCP instance' for this RTP sink:
  const unsigned estimatedSessionBandwidth = 4500; // in kbps; for RTCP 
b/w share
  const unsigned maxCNAMElen = 100;
  unsigned char CNAME[maxCNAMElen+1];
  gethostname((char*)CNAME, maxCNAMElen);
  CNAME[maxCNAMElen] = '\0'; // just in case
/*#ifdef IMPLEMENT_RTSP_SERVER
  RTCPInstance* rtcp =
#endif
*/
    RTCPInstance::createNew(*env, &rtcpGroupsock,
                              estimatedSessionBandwidth, CNAME,
                              videoSink, NULL /* we're a server */, 
isSSM);

  // Finally, start the streaming:
  *env << "Beginning streaming...\n";
  play();

  env->taskScheduler().doEventLoop(); // does not return

  return 0; // only to prevent compiler warning
}

void afterPlaying(void* /*clientData*/) {
  *env << "...done reading from file\n";

  Medium::close(videoSource);
#ifdef SOURCE_IS_PROGRAM_STREAM
  Medium::close(mpegDemux);
#endif
  // Note that this also closes the input file that this source read from.

  play();
}

void play() {
  // Open the input file as a 'byte-stream file source':
  ByteStreamFileSource* fileSource
    = ByteStreamFileSource::createNew(*env, inputFileName);
  if (fileSource == NULL) {
    *env << "Unable to open file \"" << inputFileName
         << "\" as a byte-stream file source\n";
    exit(1);
  }
 
  FramedSource* videoES;
#ifdef SOURCE_IS_PROGRAM_STREAM
  // We must demultiplex a Video Elementary Stream from the input source:
  mpegDemux = MPEG1or2Demux::createNew(*env, fileSource);
  videoES = mpegDemux->newVideoStream();
#else
  // The input source is assumed to already be a Video Elementary Stream:
  videoES = fileSource;
#endif

  // Create a framer for the Video Elementary Stream:
  videoSource
    = MPEG1or2VideoStreamFramer::createNew(*env, videoES, iFramesOnly);

  // Finally, start playing:
  *env << "Beginning to read from file...\n";
  videoSink->startPlaying(*videoSource, afterPlaying, videoSink);
}


thanks for you attention.

________________________
     Julien Savarese 
     Apprenti ingénieur. 
     Division SIS/DPM/RMS/MIE.
---------------------------------------------




Ross Finlayson <finlayson at live555.com> 
Envoyé par : live-devel-bounces at ns.live555.com
07/05/2008 17:40
Veuillez répondre à
LIVE555 Streaming Media - development & use <live-devel at ns.live555.com>


A
LIVE555 Streaming Media - development & use <live-devel at ns.live555.com>
cc

Objet
Re: [Live-devel] (no subject)






Unable to determine our source address: This computer has an invalid IP 
address: 0x0
Beginning streaming...
Beginning to read from file...
**********************************************************************************

I don't understand, because my IP adresse  is correct, but i'm using the 
same computer to stream and receive,

Nonetheless, something is wrong with the networking configuration of your 
system, because neither of the methods we use to determine the computer's 
IP address - (1) multicast loopback and (2) gethostname()+gethostbyname() 
- is working.

The most common reason for this error is that IP multicast is not 
configured correctly on your system.  Make sure that you have a route 
installed for 224/8.
-- 


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/_______________________________________________
live-devel mailing list
live-devel at lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel


Pensez a l'environnement : avez-vous besoin d'imprimer ce message
Think Environment : Do you need to print message ?

Ce courrier électronique, et éventuellement ses pièces jointes, peuvent contenir des informations confidentielles et/ou  personnelles et a été envoyé uniquement à l'usage de la personne ou de l'entité  citée ci-dessus. Si vous receviez ce courrier électronique par erreur, merci de bien vouloir en avertir l'expéditeur immédiatement par la réponse en retour à ce courrier  et effacer l'original et détruire toute copie enregistrée dans un ordinateur, ou imprimée ou encore sauvegardée sur un disque . Toute  revue, retransmission ou toute autre forme d'utilisation de ce courrier électronique par toute autre personne que le destinataire prévue est strictement interdite.

L'internet ne permettant pas d'assurer l'intégrité de ce message, l'expéditeur décline toute responsabilité au cas où il aurait été intercepté ou modifié par quiconque.

This e-mail and possibly any attachment may contain confidential and/or privileged information and is intended only for the use of the individual or entity named above.  If you have received it in error, please advise the sender immediately by reply e-mail and delete  and destroy all copies including all copies stored in the recipient's computer, printed or saved to disk. . Any review , retransmission, or further use of this e-mail by by persons or entities other than the intended recipient is strictly  prohibited.  Because of the nature of the Internet the sender is not in a position to ensure the integrity of this message, therefore the sender disclaims any liability whatsoever, in the event of this message having been intercepted and/or altered.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20080513/e1e79ab5/attachment-0001.html>


More information about the live-devel mailing list