[Live-devel] UTP to RTP
Andrew Umlauf
andrew_umlauf at yahoo.com
Thu Jul 30 07:43:36 PDT 2009
I am trying to configure an app to take a UDP source and stream it via RTP. However, I cannot get it to work. When I trace through the code, I find that on line 155 of MPEGVideoStreamFramer.cpp, aquiredFrameSize is never greater than 0.
The following is my code:
-Andrew
#include "liveMedia.hh"
#include "BasicUsageEnvironment.hh"
#include "GroupsockHelper.hh"
MediaSource* videoSource;
void afterPlaying(void*);
int main()
{
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
UsageEnvironment*env = BasicUsageEnvironment::createNew(*scheduler);
//Create our sink variables...
char const* destinationAddrStr = "147.159.167.150";
const unsigned char ttl = 7;
const Port rtpPort(8888);
struct in_addr destinationAddress;
destinationAddress.s_addr = our_inet_addr(destinationAddrStr);
Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
//Create our sink...
RTPSink* videoSink = MPEG1or2VideoRTPSink::createNew(*env, &rtpGroupsock);
if(videoSink == NULL){
*env << "Unable to create sink \n";
exit(1);
}
//Create our source variables...
char const* srcAddrStr = "10.0.0.10";
struct in_addr srcAddress;
srcAddress.s_addr = our_inet_addr(srcAddrStr);
const Port udpPort(1234);
Groupsock udpGroupsock(*env, srcAddress, udpPort, ttl);
//Create our source...
FramedSource* input = BasicUDPSource::createNew(*env, &udpGroupsock);
if (input == NULL) {
*env << "Unable to open source \n";
exit(1);
}
//Create our framer...
videoSource = MPEG1or2VideoStreamFramer::createNew(*env, input);
//Start to stream the data....
videoSink->startPlaying(*videoSource, afterPlaying, videoSink);
env->taskScheduler().doEventLoop();
return 0;
}
void afterPlaying(void*) {
Medium::close(videoSource);
}
More information about the live-devel
mailing list