Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support io hooks #1

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open

support io hooks #1

wants to merge 48 commits into from

Conversation

byrcoder
Copy link

My project works with coroutine, while librtmp only support raw tcp send and recv. This commit supports the io behavior determined by the user.

Howard Chu and others added 30 commits November 1, 2012 17:00
Missing semicolon in e42b5d0
DumpMetadata needs to recognize ARRAY types now.
This was broken in e42b5d0. This makes adobe auth against
akamai servers work again.
Some servers (akamai) only include a 'challenge' parameter, no
'opaque' parameter, while others (wowza) include both 'opaque'
and 'challenge'. If 'opaque' is provided, it should be used here,
otherwise 'challenge', but never both.

After this patch, adobe auth works against both wowza and akamai
servers.
The variable is any random challenge, thus the byte order doesn't
matter at all.
The internal functions gnutls_calc_dh_secret and gnutls_calc_dh_key
have changed signature in recent gnutls versions - don't use them
but manually do roughly the same as what they used to do before
using only public API functions.
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.
These libraries are linked and used as directly as we use gnutls
itself. This fixes linking for callers if librtmp is built
statically or if the linker doesn't support transitive linking.
This is required when a user of librtmp is linking statically to
librtmp (when it is built with gnutls support).

Ideally everything of the Requires line should be in
Requires.private, and -lgmp would go into Libs.private - but if
only building a static lib, they should go where they are right
now instead. Keeping all of this where it is right now, for now,
for simplicity.
Commit a928232 changed the layout of the RTMP struct, making
it ABI-incompatible with previous versions.
This matters if the buffer overflows, when the count is used
for patching the buffer back together. This happens if there
are multiple video packets with zero timestamp at the start
of the stream (before any audio packets), enough to fill the buffer.
As described in Adobe’s RTMP specification dated 21 Dec 2012; also:

* RTMPY ticket #107, “Compressed headers also can have an extended
  timestamp”,
  http://web.archive.org/web/20120624031323/http://dev.rtmpy.org/ticket/107
* https://rarut.wordpress.com/2012/03/21/announcing-nginx-rtmp-module/

This resolves intermittent hangs, segfaults and crashes I was seeing when
starting ABC News 24 streams, e.g.:

rtmpdump -r rtmp://cp81899.live.edgefcs.net/live/news24-med@28772 --live

Some of the packets seemed to contain junk timestamp fields, which often
required the extended field.
This fixes authentication with wowza 4.x servers, which don't
send any close message in the authentication process.
This makes sure we don't free tcUrl in RTMP_Close when reconnecting,
and avoids leaks (or simplifies code to avoid leaks).

This fixes connecting with authentication (both adobe and limelight)
when the app has been specified separately from the rest of the url.

This is only a temporary step while refactoring, this is removed
in a later commit.
Instead of having a plethora of flags indicating the current
state (just to avoid freeing them when closing the previous
connection when reconnecting), split RTMP_Close into CloseInternal,
taking a flag saying whether this is a reconnect or a normal,
final RTMP_Close call.

This also avoids leaks of some strings, if the whole session is
closed while the authentication process is underway.
This gets rid of the overlap between these two flags, shortening
the code somewhat.
Section 5.3.1.3 of the RTMP spec say that type 3 packets also
should repeat this field. This matches what the parsing code (in
RTMP_ReadPacket) does.
Init str on unsupported references
check for input buffer underrun
Fix 39ec7ed
move the check to allow valid loop termination
AMFProp_GetObject must make sure the prop is actually an object
@gabefair
Copy link

gabefair commented Sep 5, 2021

Thanks for doing this. Code works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants