Add a new option 'rtmp_flush_interval' that allows specifying the
number of packets to write before sending it off as a HTTP request.
This is mostly relevant for RTMPT - for plain RTMP, it only controls
how often we check the socket for incoming packets, which shouldn't
affect the performance in any noticeable way.
Signed-off-by: Martin Storsjö <martin@martin.st>
This adds two protocols, but one of them is an internal implementation
detail just used as an abstraction layer/generalization in the code. The
RTMPT protocol implementation uses rtmphttp:// as an alternative to the
tcp:// protocol. This allows moving most of the lower level logic out
from the higher level generic rtmp code.
Signed-off-by: Martin Storsjö <martin@martin.st>
This makes sure all incoming packets are read and handled (and reacted
to) while sending an FLV stream over RTMP to a server. If there were
enough incoming data to fill the TCP buffers, this could potentially
make things block at unexpected places. For the upcoming RTMPT support,
we need to consume all incoming data before we can send the next
request.
Signed-off-by: Martin Storsjö <martin@martin.st>
This factorizes existing code into a new function gen_buffer_time(),
which generates the client buffer time message and sends it to the
server.
Signed-off-by: Martin Storsjö <martin@martin.st>
Allow using connection parameters in order to append arbitrary
AMF data like "B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0" to the
Connect message. You can pass these parameters through the -rtmp_conn
option.
Signed-off-by: Martin Storsjö <martin@martin.st>
If using the new -rtmp_app and -rtmp_playpath parameters,
one can in many cases set the main url to just rtmp://server/.
If the trailing slash is omitted, path is a string of zero length,
and using path+1 will end up reading uninitialized data.
Signed-off-by: Martin Storsjö <martin@martin.st>
According to the behaviour of librtmp, it is recommended to send this
message to the server after receiving the 'onBWDone' callback in order
to do bandwidth checking and improve compatibility with some servers.
This option is the stream identifier to play or to publish.
Sometimes the URL parser cannot determine the correct
playpath automatically, so it must be given explicitly
using this option (ie. -rtmp_playpath).
Signed-off-by: Martin Storsjö <martin@martin.st>
This option is the name of application to connect on the RTMP server.
Sometimes the URL parser cannot determine the app name automatically,
so it must be given explicitly using this option (ie. -rtmp_app).
Signed-off-by: Martin Storsjö <martin@martin.st>
The audio codecs property is composed by all values except
SUPPORT_SND_INTEL (0x0008) and SUPPORT_SND_UNUSED (0x0010) which are
unused.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This definition is in two files, since the definitions will move
to the private header at the next bump.
Signed-off-by: Martin Storsjö <martin@martin.st>
The existing functions defined in intfloat_readwrite.[ch] are
both slow and incorrect (infinities are not handled).
This introduces a new header with fast, inline conversion
functions using direct union punning assuming an IEEE-754
system, an assumption already made throughout the code.
The one use of Intel/Motorola extended 80-bit format is
replaced by simpler code sufficient under the present
constraints (positive normal values).
The old functions are marked deprecated and retained for
compatibility.
Signed-off-by: Mans Rullgard <mans@mansr.com>
704af3e29c broke publishing
of rtmp streams, at least publishing to Wowza servers.
This changes all invoke commands to use nb_invokes.
Signed-off-by: Martin Storsjö <martin@martin.st>
This simplifies the open functions by avoiding one function
call that needs error checking, reducing the amount of
extra bulk code.
Signed-off-by: Martin Storsjö <martin@martin.st>
Note: FCPublish/FCUnpublish are adobe server specific and not described
in the rtmp specification. Some servers might not cope with them at
all.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This makes the RTMP writing code able to handle FLV data
fed in arbitrarily small or large chunks, with multiple
consecutive packets in one write call, or having the FLV
packet header split over numerous write calls.
When used in conjunction with the flv muxer, the AVIO buffer
size still needs to be large enough to fit the initial metadata
packet though, since the size of that packet is written with a
seekback.
Signed-off-by: Martin Storsjö <martin@martin.st>
If not enough bytes are available, keep track of them and skip
them on next call.
In practice, if these trailer bytes are written in a separate
call, there is no other data written in this call, making it
fall into the "FLV packet too small" case currently - working,
but not as intended.
This patch makes the code more robust, handling all cases
except for having the FLV packet header split over multiple
write calls.
Signed-off-by: Martin Storsjö <martin@martin.st>
If the FLV packet is larger than the AVIO buffer, a partial
FLV packet will be flushed to the RTMP protocol.
This commit handles the most common cases of FLV packets
being written in more than one call.
Signed-off-by: Martin Storsjö <martin@martin.st>
Original code had the assumption of only one FLV packet per RTMP packet. But that assumption is incorrect for higher bit rates. Made changes to the code to accommodate more than one FLV packet per RTMP
+packet.
Some received packets can have size 0. The return value from
av_malloc(0) may be NULL, which is ok if the size was 0. On
OS X, however, the returned pointer is non-null but leads to
crashes when trying to free it.
Signed-off-by: Martin Storsjö <martin@martin.st>
Make AVIO_FLAG_ access constants work as flags, and in particular fix
the behavior of functions (such as avio_check()) which expect them to
be flags rather than modes.
This breaks API.