Author Topic: Live555 is not sending the frame  (Read 10 times)

Offline Edimartin

  • Member
  • Posts: 6
  • C++ developer from Brazil
    • View Profile
Live555 is not sending the frame
« on: Today at 12:04:55 PM »
Hi. I need use live555 to send a x264 frame from my Camera to the VLC.
Is this the right forum to ask this?


I use openCV to get the camera frame and convert from BGR to YUV.
I use x264 to convert the frame.
Butt the live555 is not sending the frame.


I create a RTSPServer

Code: [Select]
lookupServerMediaSession(char const* streamName){
//
//lookUp for the session with the name
ServerMediaSession* sms = RTSPServer::lookupServerMediaSession(streamName);
if (!sms){
//create the session if this is't exist
sms = ServerMediaSession::createNew(envir(), streamName,"send server","sending the camera");
if (sms){
//add a subsession
sms->addSubsession( CameraServerMediaSubsession::createNew(envir(),true) );
}
}
return sms;
 }


The subsession create a FramedSource and VideoRTPSink

Code: [Select]
FramedSource* CameraServerMediaSubsession::createNewStreamSource(unsigned clientSessionId,
      unsigned& estBitrate)
{
//
return new CameraStream(this->envir());
}
RTPSink* CameraServerMediaSubsession::createNewRTPSink(Groupsock* rtpGroupsock,
    unsigned char rtpPayloadTypeIfDynamic,
    FramedSource* inputSource){
//
return CameraVideoRTPSink::createNew(this->envir(),
rtpGroupsock,
rtpPayloadTypeIfDynamic);
}


I write the CameraStream (FramedSource) using this example:

http://www.live555.com/liveMedia/doxygen/html/DeviceSource_8cpp-source.html

Here is the code.

Code: [Select]
void CameraStream::doGetNextFrame(){
//
if (!isCurrentlyAwaitingData()) return; // we're not ready for the data yet

//get the size of the x264 frame
unsigned newFrameSize = cameraSize;
//create the frame
u_int8_t* newFrameDataStart = new u_int8_t[newFrameSize];


//copy the frame data
memcpy(newFrameDataStart,camera,cameraSize);
 
//This I found in the example
if (newFrameSize > fMaxSize) {
fFrameSize = fMaxSize;
fNumTruncatedBytes = newFrameSize - fMaxSize;
} else {
fFrameSize = newFrameSize;
}

//move the frame to FTO
memmove(fTo, newFrameDataStart, fFrameSize);
 
//Inform the reader it's now avaliable
FramedSource::afterGetting(this);
}


The server run the doGetNextFrame function in CameraStream. But the frame is not sent.

Do someone know how can I set the live555 to send the frame?