live555轉發ps流的時間戳及分幀問題

       現在基本實現live555轉發ps流,但是由於沒有正確處理時間戳及分幀問題,導致接收端數據回調的不正確。

       問題可以分爲兩個:1、時間戳 2、marker的標記

        最終的處理方法爲

        void SimpleRTPSink::doSpecialFrameHandling(unsigned fragmentationOffset,
  unsigned char* frameStart,
  unsigned numBytesInFrame,
  struct timeval frameTimestamp,
  unsigned numRemainingBytes) {

  if (numBytesInFrame> 3 &&(frameStart[0] == 0x00 && frameStart[1] == 0x00 & frameStart[2] == 0x01 && frameStart[3] == 0xBA) ) {

    // This packet contains the last (or only) fragment of the frame.

    // Set the RTP 'M' ('marker') bit, if appropriate:

//fNumFramesUsedSoFar = 0;

    //if (fSetMBitOnLastFrames) setMarkerBit();

//2014-06-13 fix me, marker not set now 

//setMarkerBit();



// Important: Also call our base class's doSpecialFrameHandling(),

// to set the packet's timestamp:

MultiFramedRTPSink::doSpecialFrameHandling(fragmentationOffset,

frameStart, numBytesInFrame,

frameTimestamp,

numRemainingBytes);

                                       }

                                }

               時間戳的問題得以解決,而marker標準位的問題可以通過setMarkerBit();該函數實現。一所檢測環境中,視頻流也沒有加marker,所以我暫不處理。 後面可以通過前面傳入或緩存一幀的方式解決該問題。




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章