]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpenc_chain.c
oggspeexparse: fix array overread
[ffmpeg] / libavformat / rtpenc_chain.c
index c0f9530ac8f52457ca097e3ad331dda6e407f8e0..df7410d0c82667cb90c966d8897d9689e7925d5e 100644 (file)
 #include "avio_internal.h"
 #include "rtpenc_chain.h"
 #include "avio_internal.h"
+#include "rtp.h"
 #include "libavutil/opt.h"
 
 int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
-                          AVStream *st, URLContext *handle, int packet_size)
+                          AVStream *st, URLContext *handle, int packet_size,
+                          int idx)
 {
     AVFormatContext *rtpctx = NULL;
     int ret;
@@ -59,6 +61,14 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s,
     rtpctx->streams[0]->sample_aspect_ratio = st->sample_aspect_ratio;
     rtpctx->flags |= s->flags & AVFMT_FLAG_MP4A_LATM;
 
+    /* Get the payload type from the codec */
+    if (st->id < RTP_PT_PRIVATE)
+        rtpctx->streams[0]->id =
+            ff_rtp_get_payload_type(rtpctx, st->codec, idx);
+    else
+        rtpctx->streams[0]->id = st->id;
+
+
     if (av_opt_get(s, "rtpflags", AV_OPT_SEARCH_CHILDREN, &rtpflags) >= 0)
         av_dict_set(&opts, "rtpflags", rtpflags, AV_DICT_DONT_STRDUP_VAL);