使用live555 拉流,在基于udp的rtp流情况下, 面对udp不稳定不可靠的传输层,需要做rtp乱序重排的处理。 否则rtp组包得到的视频包内部错位,解码花屏。 live555 rtp接受端,在代码: liveMedia/MultiFramedRTPSource.cpp? 内部类ReorderingPacketBuffer
private: ? ? ? unsigned fThresholdTime; // uSeconds
重排序等待的缓冲时间,fThreadholdTime, 单位微秒, 默认值 100 ms 可以通过接口设置: 参考 testProgs/PlayCommon.cpp 在自己实现的?continueAfterDESCRIBE 函数里面设置
testProgs/PlayCommon.cpp
void continueAfterDESCRIBE(RTSPClient*, int resultCode, char* resultString){
......
if (subsession->rtpSource() != NULL) {
// Because we're saving the incoming data, rather than playing
// it in real time, allow an especially large time threshold
// (1 second) for reordering misordered incoming packets:
unsigned const thresh = 1000000; // 1 second
subsession->rtpSource()->setPacketReorderingThresholdTime(thresh);
......
}
这个值设置的越大,抗乱序效果越好,但是相应地延迟会增大。
|