Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-29 11:21:34 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-14 00:39:49 +0300
commit3b49688440e7bd004634fe289d3f0e128df236fa (patch)
tree53208da84bcefc8a3ce73fac6f20d1d132ffc644 /libavformat
parentb5873ca4f527570814420adf10bec529f76b2402 (diff)
avformat/movenc: Fix segfault when remuxing rtp hint stream
When remuxing an rtp hint stream (or any stream with the tag "rtp "), the mov muxer treats this as one of the rtp hint tracks it creates internally when ordered to do so; yet this track lacks the AVFormatContext for the hinting rtp muxer, leading to segfaults in mov_write_udta_sdp() if a "trak" atom is written for this stream; if not, the stream's codecpar is freed by mov_free() as if the mov muxer owned it (it does for the internally created "rtp " tracks), but without resetting st->codecpar, leading to double-frees lateron. This commit therefore ignores said tag which makes rtp hint streams unremuxable. This fixes tickets #8181 and #8186. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit 22c3cd176079dd104ec7610ead697235b04396f1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d69e0e543d..82e20011ed 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1470,6 +1470,10 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
{
int tag = track->par->codec_tag;
+ // "rtp " is used to distinguish internally created RTP-hint tracks
+ // (with rtp_ctx) from other tracks.
+ if (tag == MKTAG('r','t','p',' '))
+ tag = 0;
if (!tag || (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL &&
(track->par->codec_id == AV_CODEC_ID_DVVIDEO ||
track->par->codec_id == AV_CODEC_ID_RAWVIDEO ||