Commit Graph

162 Commits

Author SHA1 Message Date
Alexandra Khirnova 5626f994f2 avformat: Use av_reallocp() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-18 18:28:38 +02:00
Josh Allmann 8583b14252 rtmp: Support reading interleaved chunks.
A given packet won't always come in contiguously; sometimes
they may be broken up on chunk boundaries by packets of another
channel.

This support primarily involves tracking information about the
data that's been read, so the reader can pick up where it left
off for a given channel.

As a side effect, we no longer over-report the bytes read if
(toread = MIN(size, chunk_size)) == size

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 23:19:11 +03:00
Martin Storsjö dc4acc8200 rtmpproto: Extend a comment to explain the prev_pkt arrays roles
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 20:09:25 +03:00
Martin Storsjö 647d655d19 rtmpproto: Consistently use the right prev_pkt array
prev_pkt[0] is used for input packets, while prev_pkt[1] is
used for output.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 20:09:24 +03:00
Martin Storsjö 0d3784396b rtmpproto: Check for the right return code
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 20:09:22 +03:00
Josh Allmann f8d1bb6723 rtmp: rename main_channel_id to stream_id.
This more closely corresponds to the usage of the field.
Its usage here is unrelated to the channel ID.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:03:36 +03:00
Josh Allmann d4aef99780 rtmp: Follow Flash player numbering for channels.
Channel 4 is typically used by the Flash player to transmit
audio, channel 6 for video, and various stream-specific invokes
get sent over channel 8, which is designated the source channel.

This more closely matches the behavior of the Flash player,
including the transmission of play requests over channel 8.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:03:36 +03:00
Josh Allmann 120af23cd5 rtmp: Send video on a separate channel.
Sending non-monotonic packets (e.g. when the audio and video
streams are monotonic within themselves but not muxed
monotonically) will lead to negative values the RTMP timestamp
field (where timestamps are transmitted only as deltas for each
channel), and this delta can end up being incorrectly written as
a large unsigned number.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-17 11:03:36 +03:00
Luca Barbato 92ed83e393 rtmp: Store all the notify messages
The onTextData is used to implement text data streams in flv.
2013-09-16 19:36:37 +02:00
Luca Barbato fe0337e89b rtmp: Do not send the first field twice within the handshake 2013-09-16 19:36:37 +02:00
Luca Barbato 666ed7eda1 rtmp: Drop an unneeded warning
Apparently a widely used streaming server requires that the second
field always presents a version during C1 phase.
2013-09-16 19:36:37 +02:00
Luca Barbato ffb7669e47 rtmp: Support play method in listen mode 2013-09-16 19:36:37 +02:00
Luca Barbato 97d35fa89f rtmp: Factor out publish specific code
Will be reused for supporting play.
2013-09-16 19:36:37 +02:00
Martin Storsjö 6454c44f9f rtmpproto: Fix limelight authentication with abbreviated app names
When streaming to limelight, the app name is either a full
"appname/subaccount" or "appname/_definst_". In the latter case,
the app name can be simplified into simply "appname", but the
authentication hashing assumes the /_definst_ still to be present.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-28 17:54:51 +03:00
Luca Barbato 5718e3487b rtmp: Do not misuse memcmp
CC: libav-stable@libav.org
2013-08-11 01:19:27 +02:00
Martin Storsjö 8e1fe34557 rtmp: Detect and warn if the user tries to pass librtmp style parameters
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-10 18:37:18 +03:00
Luca Barbato ba5393a609 rtmp: rename data_size to size 2013-08-10 13:49:09 +02:00
Luca Barbato 4ebc7d659f rtmp: Use PRId64 when needed. 2013-08-10 13:48:48 +02:00
Gavriloaie Eugen-Andrei 0d6fa3977b rtmp: Add seek support
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-02 20:11:54 +03:00
Kostya Shishkov de421b2085 use my full first name instead of short one in copyrights 2013-06-01 13:38:50 +02:00
Diego Biurrun 2832ea26f3 Remove commented-out debug #define cruft 2013-05-16 00:23:30 +02:00
Martin Storsjö a5e6080a8d rtmp: Pass the parameters to do_adobe_auth in the right order
do_adobe_auth takes the parameters in the order "opaque, challenge".

Due to the way they are treated, this didn't matter in the tested
setups though - if both are set, we only use one. In the tested
setups (Wowza and Akamai) either one of them were null or they
were both set to the same value, which is why this worked before.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-20 12:00:28 +02:00
Michael Niedermayer 6dc8505417 rtmpproto: Fix assignments in if()
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-14 13:13:00 +02:00
Martin Storsjö c1ea44c54d rtmp: Add support for limelight authentication
Limelight is a not too uncommon CDN. The authentication scheme is
pretty similar to the adobe authentication, but is even closer to
normal http digest authentication (but not close enough to warrant
sharing code) than the adobe version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-31 13:39:09 +02:00
Martin Storsjö 08225d0126 rtmp: Add support for adobe authentication
This is mostly used to authenticate the client when publishing.
Tested with wowza and akamai.

Some but not all servers support resending a new connect invoke
within the same connection, so always reconnect for sending a new
connection attempt. This matches what other applications do as well.

The authentication scheme is structurally pretty similar to http
digest authentication, but uses base64 instead of hex strings.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-31 13:39:08 +02:00
Martin Storsjö c76daa89ab rtmp: Return a proper error code in handle_invoke_error
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-12-31 13:39:06 +02:00
Martin Storsjö d578f94746 rtmp: Use av_strlcat instead of strncat
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-11-05 15:37:09 +02:00
Michael Niedermayer 2f1b2ff934 rtmpproto: Fix an out of array write
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-12 18:16:59 +03:00
Martin Storsjö e002e3291e Use the new aes/md5/sha/tree allocation functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-11 23:35:28 +03:00
Martin Storsjö e6153f173a avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:44 +03:00
Martin Storsjö 124134e424 avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:32 +03:00
Samuel Pitoiset 7011a42b1a rtmp: support strict rtmp servers
In order to send or receive a stream FCPublish, FCSubscribe and _checkbw
are completely optional and often not implemented. releaseStream over a
non-existen stream might report an error instead of being silent.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-08-22 17:55:17 +02:00
Martin Storsjö cb5ab02a88 rtmp: Use int instead of ssize_t
Not all compilers support ssize_t (MSVC doesn't), and none of these
variables need to be larger than 32 bit.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-16 23:02:26 +03:00
Jordi Ortiz e5f2731c73 rtmp: Add support for receiving incoming streams
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-16 18:13:41 +03:00
Samuel Pitoiset 93f257db6b rtmp: Automatically compute the hash for SWFVerification
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 22:05:36 +03:00
Samuel Pitoiset 635ac8e1be rtmp: Add support for SWFVerification
Specifies how the server verifies client SWF files before allowing the
files to connect to an application. Verifying SWF files is a security
measure that prevents someone from creating their own SWF files that can
attempt to stream your resources.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 10:37:34 +03:00
Samuel Pitoiset fb7e78089b rtmp: Gracefully ignore _checkbw errors by tracking them
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-14 22:36:35 +03:00
Samuel Pitoiset 8b6a5a7923 rtmp: Do not send _checkbw calls as notifications
The _checkbw calls were changed to use transactionId 0 in commit
82613564 so that servers would not return _result/_error about it.
While this is the strict interpretation of the spec, there are
servers that return _error about it, even if transactionId was 0.

The latest version of EvoStream Media Server (the commercial version
of crtmpserver) behaves properly as described, i.e. returning an
_error normally but not returning anything when using transactionId
0. The latest version of crtmpserver (right now at least) doesn't
behave like this though, it returns an error even if transactionId
was 0.

There are also other servers that return errors even if transactionId
is set to 0. Therefore set a proper transaction id so that the invoke
can be tracked and the error properly ignored instead.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-14 22:31:53 +03:00
Luca Barbato fb96c1c5fe rtmp: handle bytes read reports
0x03 (bytes read report) is a known type and should be safely ignored
beside in debug situations.
2012-08-13 21:03:59 +02:00
Jordi Ortiz f5ce90f2de rtmp: split chunk_size var into in_chunk_size and out_chunk_size
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-11 15:49:37 +03:00
Samuel Pitoiset a8103503b3 rtmp: Factorize the code by adding find_tracked_method
Also fix the bytestream reader size parameter to take the
offset into account.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-11 15:15:51 +03:00
Samuel Pitoiset 3eebc1e174 rtmp: Factorize the code by adding handle_invoke_error
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-08-09 22:44:30 +02:00
Samuel Pitoiset 71036a3a5e rtmp: Factorize the code by adding handle_invoke_status
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-08-09 22:44:30 +02:00
Samuel Pitoiset 5e6001db8f rtmp: Factorize the code by adding handle_invoke_result
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-08-09 22:44:29 +02:00
Samuel Pitoiset f89584ca44 rtmp: Add message tracking
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-09 00:32:29 +03:00
Luca Barbato 82613564cf rtmp: send check_bw as notification
Set the transactionId to 0 to signal the server a return _result/_error
is not expected.

Solves the problems experienced with strict rtmp servers.
2012-08-08 14:22:34 +02:00
Samuel Pitoiset 00cb52c65c rtmp: Add a new option 'rtmp_subscribe'
This option specifies the name of live stream to subscribe.
Defaults to rtmp_playpath.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-07 23:35:39 +03:00
Samuel Pitoiset f9e77c1762 rtmp: Add support for subscribing live streams
When streaming live streams using the Akamai, Edgecast or Limelight CDN,
players cannot simply connect to the live stream. Instead, they have to
subscribe to it, by sending an FC Subscribe call to the server.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-07 23:35:39 +03:00
Samuel Pitoiset 12127b65b0 rtmp: Factorize simultaneous URLProtocol / AVClass declarations with a macro
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-07 23:35:39 +03:00
Samuel Pitoiset 9c9c21eaa1 rtmp: do not warn about receiving metadata packets
They are managed in get_packet()

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-07-31 14:52:25 +02:00