* commit '59cb5747ec3c5cd842b94e574c37889521c97cc4':
rtmpproto: read metadata to set correct FLV header
Merged-by: Michael Niedermayer <michaelni@gmx.at>
In the presence of no metadata, do not set any stream flag in the FLV
header but let the demuxer handle the detection and creation of streams
as data arrives.
Signed-off-by: Martin Storsjö <martin@martin.st>
Use default values if parsed variable is found not to
have any value. Avoids crashing at strlen for salt/user
on the auth call afterwards and needless NULL assignments
for the rest (default is already NULL for those).
Should fix Coverity Scan issues #966644 and #966645
Signed-off-by: Reynaldo H. Verdejo Pinochet <r.verdejo@sisa.samsung.com>
* commit '7ce3bd9614717e545af8fb8455032c807e389b78':
rtmpproto: Support alternative slist parameter in rtmp URLs
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Support the URL scheme where the playpath is in an RTMP URL is
passed as the slist argument and the app is given infront of the
query part of the URL:
rtmp://host[:port]/[app]?slist=[playpath]
(other arguments in the query part are stripped as they are not used)
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '6477139721f559b26eafd415e23e13ea2b0c27e1':
rtmpproto: Make sure to pass on the error code if read_connect failed
Merged-by: Michael Niedermayer <michaelni@gmx.at>
In all other cases where ff_rtmp_packet_read is used, the packet returned
is passed to rtmp_parse_result more or less immediately. In this single
case, the content of the packet was required to be a connect packet.
Some clients, e.g. Open Broadcaster Software, send a chunk size packet
before the connect packet. If the first packet is a chunk size packet,
handle it and read another one, requiring this to be a connect packet
instead.
Signed-off-by: Martin Storsjö <martin@martin.st>
Previously, if read_connect failed, the ret variable was unmodified
and had the value 0, indicating success, which then was returned from
the rtmp_open function, even though it actually failed.
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
If the url ends with .flv, we stripped it but didn't initialize
rt->playpath, doing av_strlcat on an uninitialized buffer.
Signed-off-by: Martin Storsjö <martin@martin.st>
Normally, all channel ids are between 0 and 10, while they in
uncommon cases can have values up to 64k.
This avoids allocating two arrays for up to 64k entries (at a total
of over 6 MB in size) each when most of them aren't used at all.
Signed-off-by: Martin Storsjö <martin@martin.st>
* commit '8921e32f730c191543b84e61338bc9d549aa05a3':
rtmpproto: Readjust the end of the flv buffer if handle_metadata exited early
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '24fee95321c1463360ba7042d026dae021854360':
rtmpproto: Move the flv header/trailer addition to append_flv_data
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit '4d6d70292e91a7ef027824d731b6b6570ceabf2f':
rtmpproto: Pass the 'live' parameter in the right unit
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'a6b361325f2bfc8d9d4e5f761d6c1a07b209c4fb':
rtmpproto: Print the error code string if there's no description
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This wasn't an issue prior to 58404738, when the whole RTMP packet
was copied at once and the length of the individual embedded flv
packets only were validated by the flv demuxer.
Prior to this patch, this could lead to reads and writes out of bound.
Signed-off-by: Martin Storsjö <martin@martin.st>
If the embedded flv packets were incomplete and we aborted the
copying loop early, make sure the flv buffer is trimmed to
only contain full packets.
Signed-off-by: Martin Storsjö <martin@martin.st>
update_offset is also called from handle_metadata, where the
packet header sizes is already included in the size.
Previously this lead to flv_data/flv_size including 15 uninitialized
bytes at the end after each call to handle_metadata, making the
flv demuxer lose sync with the stream.
Also remove leftover copying in handle_metadata. This is a leftover
from the refactoring in 5840473. (Previously this final mempcy was
the one that copied all the packets at once, while this is done
within the loop right now.) After making sure flv_size is set to
the right size, this write was out of bounds.
Signed-off-by: Martin Storsjö <martin@martin.st>
This was overlooked in d872fb0f7 since I assumed all the realloc
issues in the rtmp code was fixed already.
Signed-off-by: Martin Storsjö <martin@martin.st>
The current magic numbers passed are values in seconds, while the
parameter itself should be passed over the wire in milliseconds.
This makes (some/all?) live streams from Red5 work correctly, that
previously returned StreamNotFound even with "-rtmp_live live". After
this commit, the default 'any' also works on these streams.
Signed-off-by: Martin Storsjö <martin@martin.st>
On (certain streams/setups at least on) Red5, the description string
actually is present, but empty. Therefore, first try loading the
description, but if not found or empty, load the code string instead.
The code string is quite understandable in most cases anyway (like
"NetStream.Play.StreamNotFound").
Signed-off-by: Martin Storsjö <martin@martin.st>
When av_reallocp fails, the associated variables that keep track of
the number of elements in the array (and in some cases, the
separate number of allocated elements) need to be reset.
Not all of these might technically be needed, but it's better to
reset them if in doubt, to make sure variables don't end up
conflicting.
Signed-off-by: Martin Storsjö <martin@martin.st>
Use update_offset() as done for rtmp audio, video and notifications and
read update and write the fields instead of replacing them in the rtmp
packet and then memcpying it to the output buffer.
* commit 'b97b1adb3f807e1acd00d56319ee6cb41cc727e4':
rtmpproto: Add a comment explaining the logic in handle_notify
Merged-by: Michael Niedermayer <michaelni@gmx.at>