diff mbox series

[FFmpeg-devel] Relay RTP Extension Header

Message ID 33824A70-C125-441B-9666-E1F7006B0EB9@mac.com
State New
Headers show
Series [FFmpeg-devel] Relay RTP Extension Header | expand

Checks

Context Check Description
andriy/default pending
andriy/make_warn warning New warnings during build
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

John Laxson April 28, 2020, 8:20 p.m. UTC
Attached is a small patch-in-concept to provide access to extension headers received in RTP streams by passing the header as AVPacket side data.  My specific use case is accessing metadata embedded in streams from Parrot hardware [1].   Is this functionality something you would be interested in landing?  If so, could you provide some architectural guidance on where to flesh it out - is AV_PKT_DATA_NEW_EXTRADATA appropriate, or define another?  Any other places this needs to be handled?

Sincerely,
John Laxson

[1] https://developer.parrot.com/docs/pdraw/metadata.html

Signed-off-by: John Laxson <jlaxson@mac.com>
---
 libavformat/rtpdec.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 3d5b200099..03d767a1a3 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -681,6 +681,11 @@  static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
 
         if (len < ext)
             return -1;
+
+        void *side_buf = av_malloc(ext);
+        memcpy(side_buf, buf, ext);
+        av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, side_buf, ext);
+
         // skip past RTP header extension
         len -= ext;
         buf += ext;