Open jbubik opened 4 years ago
This should work; but I'm not in this code right now, and don't completely understand your changes.
No new features at all. All changes in this PR address a problem on CPUs with Big Endian architecture. See Wikipedia for technical background. Original code compiles on both architectures, but woks correctly only on Little Endian CPUs (i32, amd64). When there is a 16bit value 0xABCD in RTMP packet, it is fetched into CPU as 0xCDAB on Little Endian platforms. Original code always swaps the bytes to get back the correct value 0xABCD. This "swap" is a bad idea on Big Endian platforms. See libc manual for the recommended solution. Functions ntohs/ntohl/htons/htonl are declared in the compiler according to endianess of target platform.
Hi @ut0mt8 - are you aware, that your repository is the source for OpenWrt package "nginx"? OpenWrt project supports many different routers with many different CPU architectures - some of them are Big Endian. I wanted to make the code working correctly on these architectures (I own TPLink Archer C7, MIPS BE). The project (nginx-rtmp-module) started with @arut, then has been forked by @sergey-dryabzhinsky, then has been forked by @ut0mt8. All repositories seemed abandoned in May 2020 when I authored the changes. Please let me (and/or the OpenWrt folks) know if you are willing to maintain the project. If it is not possible, the community must find a different way to go forward.
I am willing to help, but at the moment I see lack of communication between the developers. Any comments on this?
@jbubik really? I was aware of the situation. But unfortunately I tried to re-upstream my work and you no one respond, even if @arut help me in some case. The problem is I start this fork for my previous work, it was a lot of fun, but it's already too old, and don't have time to maintain it anymore. That's a shame cause my work add some interesting features (sometime the code is a bit hacky) but at least it serve well my previous employer during the 2018 soccer world cup :)
I never talked to sergy btw. So yes we are the classic situation of "abandonware" :/
I have sacrificed some sleep and made nginx-rtmp-module running on both Little-endian and Big-endian platforms. Tested with local playback and "push" functionality on PC/cygwin (x86 64bit LE) and TP-Link Archer C7 v5 (MIPS 32bit BE). Other functions (pull, record, vod, stats, etc.) untested - problems on BE expected there. The original code was written with LE perspective only. This PR fixes #22 and will collide with #23 (pierreyves258 was faster to spot the issue with gcc 8).