[Live-devel] Issue in receiving H264 ES

roshan baliga roshanbaliga at yahoo.com
Sat Jun 16 11:27:06 PDT 2012


Hi,
  I have been trying to debug an issue with a program I have written by looking at examples from the testProgs folder, where I  receive a H264 ES over RTP & store it into a file. I have noticed that if I run the program after I start the RTP source, I can successfully receive the stream and dump it into a file. However, if I run my program prior to launching the RTP source, I am unable to receive the stream and dump it into a file.
   Any help in debugging the issue will be greatly appreciated. Source follows.

Thanks,
Roshan
---------------------------------------------------------------------

#include <liveMedia.hh>
#include <BasicUsageEnvironment.hh>
#include <GroupsockHelper.hh>

UsageEnvironment* env;
char const* outputFileName = "rx_file.264";

const unsigned short inputPortNum = 15000;

// A structure to hold the state of the current session.
// It is used in the "afterPlaying()" function to clean up the session.
struct sessionState_t {
  RTPSource* source;
  H264VideoFileSink* sink;
};

struct sessionState_t sessionState;


void afterPlaying(void *);

int main() {
  // Begin by setting up our usage environment:
  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
  env = BasicUsageEnvironment::createNew(*scheduler);
     
  // Create the data sink
  sessionState.sink = H264VideoFileSink::createNew(*env, outputFileName, NULL, 100000);
  
  char const* sessionAddressStr = "0.0.0.0";

  const unsigned char ttl = 255;

  struct in_addr sessionAddress;
  sessionAddress.s_addr = our_inet_addr(sessionAddressStr);
  const Port rtpPort(inputPortNum);

  Groupsock* rtpGroupsock = new Groupsock(*env, sessionAddress, rtpPort, ttl);

  OutPacketBuffer::maxSize = 100000;

  // Create the data source
  sessionState.source = H264VideoRTPSource::createNew(*env, rtpGroupsock, 96);

  // Finally, start receiving the stream:
  *env << "Beginning receiving stream...\n";

  FramedSource* framedSource;
  framedSource = H264VideoStreamDiscreteFramer::createNew(*env, sessionState.source);

  sessionState.sink->startPlaying(*framedSource, afterPlaying, NULL);
 

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

  return 0; // only to prevent compiler warning

}

void afterPlaying(void *) {
  *env << "...done receiving\n";

  // End by closing the media:
  Medium::close(sessionState.sink);
  Medium::close(sessionState.source);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120616/745daca9/attachment-0001.html>


More information about the live-devel mailing list