[Live-devel] Access to RTP Extension Header

Brad Bitterman bitter at vtilt.com
Wed Apr 1 10:06:37 PDT 2009


Not sure if this made it through to the list so I'm resending.....

- Brad

-----------------------------------------------------------------
Ross,

I modifies MultiFramedRTPSource to add the ability to set and call a  
callback function to gain access to the RTP extended header. This  
works for my test scenario. If there is no RTP extended header  
(probably 90% of the time this is the case) then the added code has no  
effect on the the system.

I have attached a patch/diff of the changes I made. I hope you'll add  
them into the official tree....

Thanks for your help,
Brad

-----------------------------------------------------------------

diff -rupN --exclude=Makefile live/liveMedia/include/RTPSource.hh live. 
2009.02.23/liveMedia/include/RTPSource.hh
--- live/liveMedia/include/RTPSource.hh	2009-03-25 16:20:34.000000000  
-0400
+++ live.2009.02.23/liveMedia/include/RTPSource.hh	2009-02-23  
05:03:54.000000000 -0500
@@ -76,10 +76,6 @@ public:
    u_int16_t curPacketRTPSeqNum() const { return fCurPacketRTPSeqNum; }
    u_int32_t curPacketRTPTimestamp() const { return  
fCurPacketRTPTimestamp; }

-  // This is used to set a callback to retrieve the RTP Header  
Extension data
-  typedef void (*RtpExtHdrCallback_t)(uint16_t profile, uint16_t len,  
uint8_t* pHdrData, void* pPriv);
-  void setRtpExtHdrCallback( RtpExtHdrCallback_t callback, void*  
pPriv ) { fRtpExtHdrCallback = callback; fRtpExtHdrCallbackPrivData =  
pPriv;}
-
  protected:
    RTPSource(UsageEnvironment& env, Groupsock* RTPgs,
  	    unsigned char rtpPayloadFormat, u_int32_t rtpTimestampFrequency);
@@ -93,8 +89,6 @@ protected:
    Boolean fCurPacketMarkerBit;
    Boolean fCurPacketHasBeenSynchronizedUsingRTCP;
    u_int32_t fLastReceivedSSRC;
-  RtpExtHdrCallback_t fRtpExtHdrCallback;
-  void*               fRtpExtHdrCallbackPrivData;

  private:
    // redefined virtual functions:
diff -rupN --exclude=Makefile live/liveMedia/MultiFramedRTPSource.cpp  
live.2009.02.23/liveMedia/MultiFramedRTPSource.cpp
--- live/liveMedia/MultiFramedRTPSource.cpp	2009-03-30  
08:49:05.000000000 -0400
+++ live.2009.02.23/liveMedia/MultiFramedRTPSource.cpp	2009-02-23  
05:03:54.000000000 -0500
@@ -71,8 +71,6 @@ MultiFramedRTPSource

    // Try to use a big receive buffer for RTP:
    increaseReceiveBufferTo(env, RTPgs->socketNum(), 50*1024);
-
-  fRtpExtHdrCallback = NULL;
  }

  void MultiFramedRTPSource::reset() {
@@ -248,16 +246,11 @@ void MultiFramedRTPSource::networkReadHa
      ADVANCE(cc*4);

      // Check for (& ignore) any RTP header extension
-    // If a callback is set we pass any header extension info to it
      if (rtpHdr&0x10000000) {
        if (bPacket->dataSize() < 4) break;
        unsigned extHdr = ntohl(*(unsigned*)(bPacket->data()));  
ADVANCE(4);
        unsigned remExtSize = 4*(extHdr&0xFFFF);
        if (bPacket->dataSize() < remExtSize) break;
-      if( source->fRtpExtHdrCallback )
-      {
-         source->fRtpExtHdrCallback(extHdr>>16, remExtSize, bPacket- 
 >data(), source->fRtpExtHdrCallbackPrivData);
-      }
        ADVANCE(remExtSize);
      }

>



More information about the live-devel mailing list