[Live-devel] A problem for RTSPServer of m-jpeg such as "testOnDemandRTSPServer"??

최인호 ihchoi at samsung.com
Sat Aug 7 15:53:27 PDT 2004


Dear everyone.
My name is Inho Choi.

I'm developing RTSP Server for MJPEG(motion JPEG) such as testOnDemandRTSPServer.
Of cource, I made (1) a subclass of JPEGVideoSource, (2) create a new instance of JPEGVideoSource subclass and (3) create JPEGVideoRTPSink in my RTSPServer program like testOnDemandRTSPServer.
I also made my JPEGVideoFileServerMediaSubsession class like MPEG1or2VideoFileServerMediaSubsession.cpp.
When I have tested my RTSPServer program with M-player, an error is generated.
The error message of M-player is follows : 
--------------------------------------
.....
Connected to Server : xxx.xxx.xxx.xxx(my IP address)
Stream not seekable!
Initiated "video/JPEG" RTP subsession

Extieing...(End of file)
--------------------------------------

The error message of my RTSPServer program is follows :
--------------------------------------
....
play this stream using the URL "rtsp://xxx.xxx.xxx.xxx:7070/JPEGVideoTest
(When mplayer is executing)
BasicTaskScheduler::SingleStep() : select() fails: Bad file descriptor
--------------------------------------
and then this program was exited.

Why is this problem occurred?

My RTSPServer program is follows : 
======================================
int main(...)
{
    char const* inputFileName = "test.jpg";
.....
.....
.....

  // Create and start a RTSP server to serve this stream:
  char const* streamName = "JPEGVideoTest";
  RTSPServer* rtspServer
    = RTSPServer::createNew(*env, 7070);
  if (rtspServer == NULL) {
    *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
    exit(1);
  }
  ServerMediaSession* sms
 = ServerMediaSession::createNew(*env, /*NULL, progName,*/streamName, streamName, 
    "Session streamed by the URC Server", True/*SSM*/);

  sms->addSubsession(URCJPEGVideoFileServerMediaSubsession
      ::createNew(*env, inputFileName, timePerFrame, i_file_count));
  rtspServer->addServerMediaSession(sms);
 
  char* url = rtspServer->rtspURL(sms);
  *env << "Play this stream using the URL \"" << url << "\"\n";
  delete[] url;

  env->taskScheduler().doEventLoop();
}
======================================

And my JPEGVideoFileServerMediaSubsession program is follows : 
======================================
URCJPEGVideoFileServerMediaSubsession*
URCJPEGVideoFileServerMediaSubsession::createNew(UsageEnvironment& env,
        char const* fileName, unsigned timePerFrame,
        int fileNum, Boolean iFramesOnly) {
  return new URCJPEGVideoFileServerMediaSubsession(env, fileName, timePerFrame,
          fileNum, iFramesOnly);
}
URCJPEGVideoFileServerMediaSubsession
::URCJPEGVideoFileServerMediaSubsession(UsageEnvironment& env,
        char const* fileName, unsigned timePerFrame,
        int fileNum, Boolean iFramesOnly) 
  : FileServerMediaSubsession(env, fileName),
    fIFramesOnly(iFramesOnly), fTimePerFrame(timePerFrame), fFileCount(fileNum) {
}

URCJPEGVideoFileServerMediaSubsession
::~URCJPEGVideoFileServerMediaSubsession() {
}

FramedSource* URCJPEGVideoFileServerMediaSubsession
::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
  estBitrate = 500; // kbps, estimate

  return URCJPEGDeviceSource    /* <--- my JPEGVideoSource subclass  */
    ::createNew(envir(), fFileName, fTimePerFrame, fFileCount);
}

RTPSink* URCJPEGVideoFileServerMediaSubsession
::createNewRTPSink(Groupsock* rtpGroupsock,
     unsigned char /*rtpPayloadTypeIfDynamic*/,
     FramedSource* /*inputSource*/) {
  return JPEGVideoRTPSink::createNew(envir(), rtpGroupsock);
}
======================================

Thanks.


More information about the live-devel mailing list