]> git.sesse.net Git - ffmpeg/commit
avformat/webmdashenc: Avoid allocations, fix memleak
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 14 Jul 2020 22:06:10 +0000 (00:06 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 26 Jul 2020 14:39:53 +0000 (16:39 +0200)
commitf163b2eb27d88cb39a1860a8c1554b4952a50a71
treec7d2587308c29676a75a70f0ccbd07e1400e6cd3
parentc1fab8637e4bd9e0f09ae31247b709a22dafa440
avformat/webmdashenc: Avoid allocations, fix memleak

When using the WebM DASH Manifest muxer, every stream of each adaptation
set has to contain a metadata entry containing the filename of the
source file. In case of live stream manifests, said filename has to
conform to a pattern of
<file_description>_<representation_id>.<extension>. These pieces are
used to create the other strings that are actually output. Up until now,
these other strings would be allocated, used once and then freed
directly after usage. This commit changes this: The function that
allocated and assembled these strings now returns pointers to the '_'
and '.' delimiters and so that the caller can easily pick substrings
from it without needing to copy the string.

Avoiding allocations also fixes a memleak: One of the allocated strings
would leak upon a subsequent allocation failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/webmdashenc.c