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

add script and binaries for Android #2

Open
wants to merge 4 commits into
base: Android
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Work/Route_Receiver/Android_README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
How to use Route Receiver in Android:

Copy the whole Route_Receiver folder to you server root in Android, then move the binaries (flute, keepalive) in android_bin folder to /data/local/tmp/.
Change the settings for chrome browser: Open chrome://flags, then go to: Disable gesture requirement for media playback. Android Click on enable, then restart the browser.
Find the receiver in your localhost and use it the same way as the desktop version

How to compile Route Receiver in Android (not recommended):

If you encounter a problem with the existing binaries, or out of whatever reason you want to recompile the binaries. Please follow the steps:
1. make sure that you installed android NDK and toolchain correctly, and the libs like gcc are located in "/opt/android-toolchain/arm-linux-androideabi/bin",
while the user libs, include files etc. are under "/opt/android-toolchain/sysroot"(ANDROIDROOT)
2. make sure that you cross-compiled and installed curl, openssl, expat, zlib under the ANDROIDROOT!
3. compile flute and keepalive. You can save the following command as shell script and run directly in Route_Receiver

# Build libwebsocket
cd libwebsockets-master/
sed -i 's/getdtablesize()/30000/g' lib/context.c
cd build/
rm -r *
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cross-android.cmake \
-DZLIB_LIBRARY:FILEPATH=$ANDROIDROOT/usr/lib/libz.so -DZLIB_INCLUDE_DIR:PATH=$ANDROIDROOT/usr/include \
-DOPENSSL_CRYPTO_LIBRARY:FILEPATH=$ANDROIDROOT/usr/lib/libcrypto.so -DOPENSSL_EXECUTABLE:FILEPATH=$ANDROIDROOT/usr/bin/openssl \
-DOPENSSL_INCLUDE_DIR:PATH=$ANDROIDROOT/usr/include \
-DOPENSSL_SSL_LIBRARY:FILEPATH=$ANDROIDROOT/usr/lib/libssl.so \
-DCMAKE_C_FLAGS:STRING=--sysroot=$ANDROIDROOT
make
rm lib/*.so
cd ../..

# Compile flute
make clean
make

# Compile keepalive
cd android_bin
rm keepalive
$ANDROIDBIN/gcc keepalive.c -o keepalive

4. In the end, you can find the compiled flute binary in bin folder and keepalive in android_bin folder. Please copy them to /data/local/tmp and modify the browser settings
the same as stated above.
Expand Down
2 changes: 1 addition & 1 deletion Work/Route_Receiver/alclib/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CC = gcc
CC = /opt/android-toolchain/arm-linux-androideabi/bin/gcc --sysroot=/opt/android-toolchain/sysroot

CFLAGS += -Wall -O3 -g -fPIC -DLINUX -D_LARGE_FILE_API -D_LARGEFILE64_SOURCE \
-D_ISOC99_SOURCE -D_XOPEN_SOURCE=500 -D_GNU_SOURCE
Expand Down
Binary file modified Work/Route_Receiver/alclib/alc_channel.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/alc_hdr.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/alc_list.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/alc_rx.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/alc_session.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/alc_socket.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/alc_tx.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/blocking_alg.o
100755 → 100644
Binary file not shown.
2 changes: 1 addition & 1 deletion Work/Route_Receiver/alclib/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ extern "C" {
* If you want to compile the code in a system where SSM is not supported
* undefine SSM. For example in Windows 2000 SSM is not supported. */

#define SSM
//#define SSM

#define USE_ZLIB /**< Use ZLIB compression library */
#define USE_RETRIEVE_UNIT /**< Use retrieve_unit() function */
Expand Down
3 changes: 3 additions & 0 deletions Work/Route_Receiver/alclib/fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
#if (defined(MSDOS) || defined(_MSC_VER)) /* but also for others, e.g. sun... */
#define NEED_BCOPY
#define bcmp(a,b,n) memcmp(a,b,n)
#else
#define NEED_BCOPY
#define bcmp(a,b,n) memcmp(a,b,n)
#endif

#ifdef NEED_BCOPY
Expand Down
Binary file modified Work/Route_Receiver/alclib/fec.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/lct_hdr.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/mad.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/mad_rlc.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/null_fec.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/rs_fec.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/transport.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/alclib/xor_fec.o
100755 → 100644
Binary file not shown.
Binary file added Work/Route_Receiver/android_bin/flute
Binary file not shown.
Binary file added Work/Route_Receiver/android_bin/keepalive
Binary file not shown.
42 changes: 42 additions & 0 deletions Work/Route_Receiver/android_bin/keepalive.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

/* Send small UDP packets to keep the transmission alive */

#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>

int main(int argc, char**argv)
{
int sockfd,n;
struct sockaddr_in servaddr,cliaddr;
char sendline[2];

if (argc != 2)
{
printf("usage: udpcli <IP address>\n");
exit(1);
}

sockfd=socket(AF_INET,SOCK_DGRAM,0);

bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr=inet_addr(argv[1]);
servaddr.sin_port=htons(32000);

// struct timeval tval_before1, tval_after1, tval_before2, tval_after2;

while (1)
{
sendline[0]='a';
// gettimeofday(&tval_before1, NULL);
sendto(sockfd,sendline,1,0,(struct sockaddr *)&servaddr,sizeof(servaddr)); //only send one byte every time

// gettimeofday(&tval_after1, NULL);
// printf("sent at %lu.%lu, used %lu us\n", tval_before1.tv_sec, tval_before1.tv_usec, tval_after1.tv_usec-tval_before1.tv_usec);
usleep(10000);
}
}
Binary file modified Work/Route_Receiver/bin/flute
Binary file not shown.
Binary file modified Work/Route_Receiver/bin/multis_flute
Binary file not shown.
10 changes: 5 additions & 5 deletions Work/Route_Receiver/flute/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
CC = gcc
CC = /opt/android-toolchain/arm-linux-androideabi/bin/gcc --sysroot=/opt/android-toolchain/sysroot
#CC = ccmalloc g++

CFLAGS += -Wall -O3 -g -DLINUX -D_LARGE_FILE_API -D_LARGEFILE64_SOURCE -D_ISOC99_SOURCE -D_XOPEN_SOURCE=500 -D_GNU_SOURCE \
-I../flutelib \
-I/usr/local/ssl/include \
-I/usr/include
-I/opt/android-toolchain/sysroot/usr/include


LFLAGS += -L../lib -lflutelib -lalc -lsdp \
-lexpat -lpthread -lm -lz -lcurl -L../libwebsockets-master/build/lib -lwebsockets \
-L/usr/local/ssl/lib -lcrypto -lssl
-lexpat -lm -lz -lcurl -L../libwebsockets-master/build/lib -lwebsockets \
-L/opt/android-toolchain/sysroot/usr/lib -lcrypto -lssl

SOURCES = main.c

Expand Down
Binary file modified Work/Route_Receiver/flute/main.o
100755 → 100644
Binary file not shown.
4 changes: 2 additions & 2 deletions Work/Route_Receiver/flutelib/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CC = gcc
CC = /opt/android-toolchain/arm-linux-androideabi/bin/gcc --sysroot=/opt/android-toolchain/sysroot

CFLAGS += -Wall -O3 -g -fPIC -DLINUX -D_LARGE_FILE_API -D_LARGEFILE64_SOURCE -D_ISOC99_SOURCE -D_XOPEN_SOURCE=500 -D_GNU_SOURCE \
-I/usr/local/ssl/include -I../libwebsockets-master/build -I../libwebsockets-master/lib
-I/opt/android-toolchain/sysroot/usr/include -I../libwebsockets-master/build -I../libwebsockets-master/lib

SOURCES = flute.c sender.c receiver.c fdt.c fdt_gen.c mad_md5.c uri.c getdnsname.c mad_zlib.c \
padding_encoding.c parse_args.c mad_utf8.c http_file_repair.c flute_file_repair.c apd.c \
Expand Down
Binary file modified Work/Route_Receiver/flutelib/apd.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/display.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/fdt.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/fdt_gen.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/flute.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/flute_file_repair.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/getdnsname.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/http_file_repair.o
100755 → 100644
Binary file not shown.
2 changes: 1 addition & 1 deletion Work/Route_Receiver/flutelib/mad_md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ char* file_md5(const char *filename) {
#ifdef _MSC_VER
fp = fopen(filename, "rb");
#else
fp = fopen64(filename, "rb");
fp = fopen(filename, "rb");
#endif

if(fp == NULL) {
Expand Down
Binary file modified Work/Route_Receiver/flutelib/mad_md5.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/mad_utf8.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/mad_zlib.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/padding_encoding.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/parse_args.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/receiver.o
100755 → 100644
Binary file not shown.
2 changes: 1 addition & 1 deletion Work/Route_Receiver/flutelib/sender.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ int send_file(char *tx_file, int s_id, int tx_mode, unsigned short es_len, unsig
#ifdef _MSC_VER
if((fp = fopen(tx_file, "rb")) == NULL) {
#else
if((fp = fopen64(tx_file, "rb")) == NULL) {
if((fp = fopen(tx_file, "rb")) == NULL) {
#endif
printf("Error: unable to open tx_file %s\n", tx_file);
fflush(stdout);
Expand Down
Binary file modified Work/Route_Receiver/flutelib/sender.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/test-server.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/flutelib/uri.o
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/lib/libalc.a
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/lib/libflutelib.a
100755 → 100644
Binary file not shown.
Binary file modified Work/Route_Receiver/lib/libsdp.a
100755 → 100644
Binary file not shown.
Loading