Skip to content

rtpbasedepay: Drop redundant reference timestamp buffer meta.

mattc1170 requested to merge mattc1170/gstreamer:fix-multiple-meta into main

Currently, when rtspsrc property add-reference-timestamp-metadata=true, a downstream rtph264depay element will attach multiple copies of the same GstReferenceTimestampMeta to the depayloaded media buffers. This can have signficant performance impacts further downstream in a pipeline like the following one we have in our RTSP proxy server:

rtspsrc add-reference-timestamp-metadata=true ! rtph264depay ! h264parse ! ... ! rtph264pay ! ...

For example, if there are 10 packet buffers for a frame of RTP H.264 video, each of those packet buffers will contain the same reference timestamp meta. The rtph264depay element will then attach all 10 metadata to the depayloaded frame. And then later when we payload the frame buffer again for proxying, we now have 10 more buffers each with 10 instance of the same metadata. Allocating/deallocating 100+ instances of metadata @ 30fps for multiple cameras has a pretty large performance impact on our GStreamer RTSP proxy server.

This MR adds a check for repeats of the same timestamp in consecutive packets in rtpbasedepaylod and drops any duplicates.

Merge request reports