It avoids leaving dangling pointers behind in memory.
Also remove redundant checks for whether the URLContext to be closed is
already NULL.
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This will probably also fix CID 1452559, a false positive where Coverity
claims a double-free occurs, because it thinks that av_dict_set() frees
its key and value arguments even when the AV_DICT_DONT_STRDUP_* flags
aren't used.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Marvin Scholz <epirat07@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
In case an AVBPrint was not complete, icecast_open() would free some
buffers that have not been allocated yet instead of freeing the data of
the AVBPrint (if they have been allocated). Because this error does not
trigger a jump to the general cleanup section any more, one can moreover
remove a (now unnecessary) initialization of a pointer.
Furthermore, finalizing an AVBPrint can fail (namely when the string
inside the AVBPrint has not been allocated yet) and so this needs to be
checked.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Fix ticket #7297
The current setting for send-expect-100 option is either
enabled if applicable or forced enabled, no option to force
disable the header. This change is to expand the option setting
to provide more flexibility, which is useful for rstp case.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Since all URLContexts have the same AVOptions, such AVOptions
will be applied on the outermost context only and removed from the
dict, while they probably make sense on all contexts.
This makes sure that rw_timeout gets propagated to the innermost
URLContext (to make sure it gets passed to the tcp protocol, when
opening a http connection for instance).
Alternatively, such matching options would be kept in the dict
and only removed after the ffurl_connect call.
Signed-off-by: Martin Storsjö <martin@martin.st>
Instead of a linked list constructed at av_register_all(), store them
in a constant array of pointers.
Since no registration is necessary now, this removes some global state
from lavf. This will also allow the urlprotocol layer caller to limit
the available protocols in a simple and flexible way in the following
commits.
This is needed because Icecast since version 2.4.1 doesn't default
to audio/mpeg anymore. AVOption default not used here, since a later
check if -content_type is set is performed and would break.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This allows for proper error reporting. Only do
this for non-legacy requests as only Icecast >2.4.0
will reply with a proper status.
Libav seems to accept both, 100 and 200 status codes, but
let's stay close to spec.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Using 100-continue ffmpeg will only send data if the server confirms it,
so if there is an error with auth or mounpoint, this allows that it is
properly reported to the user. Else ffmpeg sends data and just quits at
some point without an error message.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
use a default (audio/mpeg for historical reason) if none. Required since Icecast 2.4.1
Not using AVOption default because this breaks content-type warnings (needs to
detect if no type was set by the user)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Icecast uses HTTP 1.0 while Libav uses HTTP 1.1 and enables by
default chunked post.
Icecast actually forwards the HTTP chunk headers to the listener
as part of the media stream (without the chunk encoding HTTP headers)
causing the players to lose sync.
Disabling the option is enough to feed icecast properly.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>