[Live-devel] Rendering a frame from H264

Neil Pepper neilpep at gmail.com
Thu Sep 6 00:30:05 PDT 2012


Hi

Have been trying to use your excellent library to connect up to a camera
that is streaming RTSP/H264 unicast from a source i have no control over. I
seem to heading in right direction but  I am struggling with the last bit,
getting the frame from the library so i can display it to the screen.

I have cloned testRTSPClient.cpp (using a non modified version assuringly i
get packets from the video stream appearing in debug), below is modified
version of continueAfterSETUP (have put in bold bits i have added), am i
going in correct direction ? This also produces reassuring debug (added to
bottom of email), am little worried about *The total received frame size
exceed... *lines but whatever I change* *OutPacketBuffer::maxSize it seems
to make no difference?

To actually get the decoded frames I assumed I had to subclass *
H264VideoStreamFramer *but cant see a way to actually get the frame, maybe
implement new version of doGetNextFrame  in class, but then processing
stops as i cant call the base class version of continueReadProcessing as
its private ? Any assistance would be appreciated .

Perhaps if some sample code of retrieving a frame and rendering to the
screen in any platform would help but i couldnt see any ?

thanks in advance

Neil

void continueAfterSETUP(RTSPClient* rtspClient, int resultCode, char*
resultString) {

  do {

    UsageEnvironment& env = rtspClient->envir(); // alias

    StreamClientState& scs = ((ourRTSPClient*)rtspClient)->scs; // alias


    if (resultCode != 0) {

      env << *rtspClient << "Failed to set up the \"" <<
*scs.subsession << "\" subsession: " << env.getResultMsg() << "\n";

      break;

    }


    env << *rtspClient << "Set up the \"" << *scs.subsession

<< "\" subsession (client ports " << scs.subsession->clientPortNum()
<< "-" << scs.subsession->clientPortNum()+1 << ")\n";



     * struct in_addr destinationAddress;*

*      destinationAddress.s_addr = our_inet_addr("0.0.0.0");*

*      *

*      const unsigned short rtpPortNum = 1234;*

*      const unsigned char ttl = 255;*

*      *

*      const Port rtpPort(rtpPortNum);*

*      *

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

*
*

*      // Create a 'H264 Video RTP' sink from the RTP 'groupsock':*

*      OutPacketBuffer::maxSize = 100000;*

*      scs.subsession->sink = H264VideoRTPSink::createNew(env,
&rtpGroupsock, 96);*

*      videoSource = H264VideoStreamFramer::createNew(env,
scs.subsession->readSource());*


      // perhaps use your own custom "MediaSink" subclass instead

    if (scs.subsession->sink == NULL) {

      env << *rtspClient << "Failed to create a data sink for the \"" <<
*scs.subsession

  << "\" subsession: " << env.getResultMsg() << "\n";

      break;

    }


    env << *rtspClient << "Created a data sink for the \"" <<
*scs.subsession << "\" subsession\n";

    scs.subsession->miscPtr = rtspClient; // a hack to let subsession
handle functions get the "RTSPClient" from the subsession

    scs.subsession->sink->startPlaying(*(*videoSource*),
subsessionAfterPlaying,
scs.subsession);

    // Also set a handler to be called if a RTCP "BYE" arrives for this
subsession:

    if (scs.subsession->rtcpInstance() != NULL) {

      scs.subsession->rtcpInstance()->setByeHandler(subsessionByeHandler,
scs.subsession);

    }

  } while (0);



  // Set up the next subsession, if any:

  setupNextSubsession(rtspClient);

}



*Opening connection to 192.168.42.1, port 554...*

*...remote connection opened*

*Sending request: DESCRIBE rtsp://192.168.42.1/AmbaStreamTest RTSP/1.0*

**

*CSeq: 2*

**

*User-Agent: drift (LIVE555 Streaming Media v2012.08.30)*

**

*Accept: application/sdp*

**

**

**

**

*Received 677 new bytes of response data.*

*Received a complete DESCRIBE response:*

*RTSP/1.0 200 OK*

**

*CSeq: 2*

**

*Date: Thu, Jan 01 1970 01:15:38 GMT*

**

*Content-Base: rtsp://192.168.42.1/AmbaStreamTest/*

**

*Content-Type: application/sdp*

**

*Content-Length: 509*

**

**

**

*v=0*

**

*o=- 54670000 1 IN IP4 192.168.42.1*

**

*s=Ambarella streaming*

**

*i=Ambarella streaming*

**

*t=0 0*

**

*a=tool:Ambarella streaming 2012.03.12*

**

*a=type:broadcast*

**

*a=control:**

**

*a=range:npt=0-*

**

*a=x-qt-text-nam:Ambarella streaming*

**

*a=x-qt-text-inf:Ambarella streaming*

**

*m=video 0 RTP/AVP 96*

**

*c=IN IP4 0.0.0.0*

**

*b=AS:600*

**

*a=rtpmap:96 H264/90000*

**

*a=fmtp:96
packetization-mode=1;profile-level-id=4D4028;sprop-parameter-sets=AAAAASjuPIA=,AAAAASdNQCiaYoNj9gIgAAB9IAAdTByAAGmYAA0y9d5cZAADTMAAaZeu8uHcIhFBGAAAAA==
*

**

*a=control:track1*

**

**

*[URL:"rtsp://192.168.42.1/AmbaStreamTest/"]: Got a SDP description:*

*v=0*

**

*o=- 54670000 1 IN IP4 192.168.42.1*

**

*s=Ambarella streaming*

**

*i=Ambarella streaming*

**

*t=0 0*

**

*a=tool:Ambarella streaming 2012.03.12*

**

*a=type:broadcast*

**

*a=control:**

**

*a=range:npt=0-*

**

*a=x-qt-text-nam:Ambarella streaming*

**

*a=x-qt-text-inf:Ambarella streaming*

**

*m=video 0 RTP/AVP 96*

**

*c=IN IP4 0.0.0.0*

**

*b=AS:600*

**

*a=rtpmap:96 H264/90000*

**

*a=fmtp:96
packetization-mode=1;profile-level-id=4D4028;sprop-parameter-sets=AAAAASjuPIA=,AAAAASdNQCiaYoNj9gIgAAB9IAAdTByAAGmYAA0y9d5cZAADTMAAaZeu8uHcIhFBGAAAAA==
*

**

*a=control:track1*

**

**

*RTCPInstance[0x24eac0]::RTCPInstance()*

*schedule(1.530479->1346841729.890146)*

*[URL:"rtsp://192.168.42.1/AmbaStreamTest/"]: Initiated the "video/H264"
subsession (client ports 59352-59353)*

*Sending request: SETUP rtsp://192.168.42.1/AmbaStreamTest/track1 RTSP/1.0*

**

*CSeq: 3*

**

*User-Agent: drift (LIVE555 Streaming Media v2012.08.30)*

**

*Transport: RTP/AVP;unicast;client_port=59352-59353*

**

**

**

**

*Received 203 new bytes of response data.*

*Received a complete SETUP response:*

*RTSP/1.0 200 OK*

**

*CSeq: 3*

**

*Date: Thu, Jan 01 1970 01:15:38 GMT*

**

*Transport:
RTP/AVP;unicast;destination=192.168.42.3;source=192.168.42.1;client_port=59352-59353;server_port=6970-6971
*

**

*Session: 5FAC6D41*

**

**

**

**

*[URL:"rtsp://192.168.42.1/AmbaStreamTest/"]: Set up the "video/H264"
subsession (client ports 59352-59353)*

*[URL:"rtsp://192.168.42.1/AmbaStreamTest/"]: Created a data sink for the
"video/H264" subsession*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*Sending request: PLAY rtsp://192.168.42.1/AmbaStreamTest/ RTSP/1.0*

**

*CSeq: 4*

**

*User-Agent: drift (LIVE555 Streaming Media v2012.08.30)*

**

*Session: 5FAC6D41*

**

*Range: npt=0.000-*

**

**

**

**

*Received 189 new bytes of response data.*

*Received a complete PLAY response:*

*RTSP/1.0 200 OK*

**

*CSeq: 4*

**

*Date: Thu, Jan 01 1970 01:15:38 GMT*

**

*Range: npt=0.000-*

**

*Session: 5FAC6D41*

**

*RTP-Info: url=rtsp://
192.168.42.1/AmbaStreamTest/track1;seq=46686;rtptime=2944705573*

**

**

**

**

*[URL:"rtsp://192.168.42.1/AmbaStreamTest/"]: Started playing session...*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*schedule(1.501818->1346841731.393142)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*MultiFramedRTPSource::doGetNextFrame1(): The total received frame size
exceeds the client's buffer size (11).  110 bytes of trailing data will be
dropped!*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*

*H264VideoStreamParser::parse() EXCEPTION (This is normal behavior - *not*
an error)*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120906/201c7f98/attachment-0001.html>


More information about the live-devel mailing list