Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit d0c8469

Browse files
Merge pull request #88 from mixer/v_9_14
9.14 rev. adding new best endpoint for ingest selection. Added Docker Build Added call to new Best v2 endpoint Added more verbose logging and error handling Added use of linter Increase the length of vendor name and version
2 parents aad863d + 036c137 commit d0c8469

21 files changed

+435
-75
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
**/.git

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
build
21
.vscode/*
32
!.vscode/settings.json
43
*.orig
54
.vs/*
5+
publish
6+
build-output

Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM debian:9
2+
3+
RUN apt-get update -y
4+
RUN apt-get install wget -y
5+
RUN apt-get install -y cmake
6+
RUN apt-get install git -y
7+
RUN apt-get install build-essential -y
8+
RUN apt-get install libssl-dev -y
9+
RUN apt-get install libcurl4-openssl-dev -y
10+
RUN apt-get upgrade ca-certificates -y
11+
12+
RUN apt-get install -y jq curl
13+
14+
RUN useradd ftl-user
15+
16+
RUN mkdir -p /opt/ftl-sdk/vid
17+
18+
RUN chown -R ftl-user:ftl-user /opt/ftl-sdk
19+
20+
WORKDIR /opt/ftl-sdk/vid
21+
22+
ARG VIDEO_URL=https://videotestmedia.blob.core.windows.net/ftl/sintel.h264
23+
RUN wget ${VIDEO_URL}
24+
ARG AUDIO_URL=https://videotestmedia.blob.core.windows.net/ftl/sintel.opus
25+
RUN wget ${AUDIO_URL}
26+
27+
COPY --chown=ftl-user:ftl-user ./CMakeLists.txt /opt/ftl-sdk/CMakeLists.txt
28+
COPY --chown=ftl-user:ftl-user ./libcurl /opt/ftl-sdk/libcurl
29+
COPY --chown=ftl-user:ftl-user ./libjansson /opt/ftl-sdk/libjansson
30+
COPY --chown=ftl-user:ftl-user ./libftl /opt/ftl-sdk/libftl
31+
COPY --chown=ftl-user:ftl-user ./Doxyfile /opt/ftl-sdk/Doxyfile
32+
COPY --chown=ftl-user:ftl-user ./ftl_app /opt/ftl-sdk/ftl_app
33+
COPY --chown=ftl-user:ftl-user ./get-video /opt/ftl-sdk/get-video
34+
COPY --chown=ftl-user:ftl-user ./get-audio /opt/ftl-sdk/get-audio
35+
COPY --chown=ftl-user:ftl-user ./scripts /opt/ftl-sdk/scripts
36+
37+
USER ftl-user
38+
39+
WORKDIR /opt/ftl-sdk
40+
41+
RUN ./scripts/build
42+
43+
COPY --chown=ftl-user:ftl-user ./start-stream /opt/ftl-sdk/start-stream
44+
45+
ENTRYPOINT ["./start-stream"]
46+

build.bat

100644100755
File mode changed.

ftl_app/main.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ int main(int argc, char **argv)
8585
int verbose = 0;
8686

8787
opterr = 0;
88-
88+
8989
charon_install_ctrlc_handler();
90-
91-
90+
91+
9292
if (FTL_VERSION_MAINTENANCE != 0)
9393
{
9494
printf("FTLSDK - version %d.%d.%d\n", FTL_VERSION_MAJOR, FTL_VERSION_MINOR, FTL_VERSION_MAINTENANCE);
@@ -158,7 +158,7 @@ int main(int argc, char **argv)
158158

159159
if (!init_video(&h264_handle, video_input))
160160
{
161-
printf("Faild to open video file\n");
161+
printf("Failed to open video file\n");
162162
return -1;
163163
}
164164
}
@@ -225,14 +225,14 @@ int main(int argc, char **argv)
225225
if (speedtest_duration)
226226
{
227227
printf("Running Speed test: sending %d kbps for %d ms", speedtest_kbps, speedtest_duration);
228-
speed_test_t results;
229-
if ((status_code = ftl_ingest_speed_test_ex(&handle, speedtest_kbps, speedtest_duration, &results)) == FTL_SUCCESS) {
230-
printf("Speed test completed: Peak kbps %d, initial rtt %d, final rtt %d, %3.2f lost packets\n",
228+
speed_test_t results;
229+
if ((status_code = ftl_ingest_speed_test_ex(&handle, speedtest_kbps, speedtest_duration, &results)) == FTL_SUCCESS) {
230+
printf("Speed test completed: Peak kbps %d, initial rtt %d, final rtt %d, %3.2f lost packets\n",
231231
results.peak_kbps, results.starting_rtt, results.ending_rtt, (float)results.lost_pkts * 100.f / (float)results.pkts_sent);
232-
}
233-
else {
234-
printf("Speed test failed with: %s\n", ftl_status_code_to_string(status_code));
235-
}
232+
}
233+
else {
234+
printf("Speed test failed with: %s\n", ftl_status_code_to_string(status_code));
235+
}
236236

237237
goto cleanup;
238238
}

get-audio

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -ue
3+
4+
OUTPUT=$1
5+
6+
curl 'https://www.dropbox.com/s/s2r6lggopt9ftw5/sintel.opus' \
7+
-H 'authority: www.dropbox.com' \
8+
-H 'cache-control: max-age=0' \
9+
-H 'upgrade-insecure-requests: 1' \
10+
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' \
11+
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \
12+
-H 'accept-encoding: gzip, deflate, br' \
13+
-H 'accept-language: en-US,en;q=0.9' \
14+
-H 'cookie: __Host-ss=UsByWdIPus; locale=en; gvc=MjU4NzQxNzA3MDE4MjU3MDIzNDY0Nzc2NjAxNDg5MTU4MTg0MjYz; seen-sl-signup-modal=VHJ1ZQ%3D%3D; t=0-Hq7tZ1TDyj-aBNiWYv8YQl; __Host-js_csrf=0-Hq7tZ1TDyj-aBNiWYv8YQl; seen-sl-download-modal=VHJ1ZQ%3D%3D' \
15+
--compressed > $OUTPUT
16+

get-video

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -ue
3+
4+
OUTPUT=$1
5+
6+
curl 'https://www.dropbox.com/s/ruijibs0lgjnq51/sintel.h264' \
7+
-H 'authority: www.dropbox.com' \
8+
-H 'cache-control: max-age=0' \
9+
-H 'upgrade-insecure-requests: 1' \
10+
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' \
11+
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \
12+
-H 'accept-encoding: gzip, deflate, br' \
13+
-H 'accept-language: en-US,en;q=0.9' \
14+
-H 'cookie: __Host-ss=UsByWdIPus; locale=en; gvc=MjU4NzQxNzA3MDE4MjU3MDIzNDY0Nzc2NjAxNDg5MTU4MTg0MjYz; seen-sl-signup-modal=VHJ1ZQ%3D%3D; t=0-Hq7tZ1TDyj-aBNiWYv8YQl; __Host-js_csrf=0-Hq7tZ1TDyj-aBNiWYv8YQl; seen-sl-download-modal=VHJ1ZQ%3D%3D' \
15+
--compressed > $OUTPUT

libftl/ftl-sdk.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ static int _lookup_ingest_ip(const char *ingest_location, char *ingest_ip);
1212
char error_message[1000];
1313
FTL_API const int FTL_VERSION_MAJOR = 0;
1414
FTL_API const int FTL_VERSION_MINOR = 9;
15-
FTL_API const int FTL_VERSION_MAINTENANCE = 13;
15+
FTL_API const int FTL_VERSION_MAINTENANCE = 14;
1616

1717
// Initializes all sublibraries used by FTL
1818
FTL_API ftl_status_t ftl_init() {
@@ -408,6 +408,8 @@ FTL_API char* ftl_status_code_to_string(ftl_status_t status) {
408408
return "the ingest socket was closed";
409409
case FTL_INGEST_SOCKET_TIMEOUT:
410410
return "the ingest socket was hit a timeout.";
411+
case FTL_INGEST_SERVER_TERMINATE:
412+
return "The server has terminated the stream.";
411413
case FTL_UNKNOWN_ERROR_CODE:
412414
default:
413415
/* Unknown FTL error */

libftl/ftl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ typedef enum {
9292
FTL_SPEED_TEST_ABORTED,
9393
FTL_INGEST_SOCKET_CLOSED,
9494
FTL_INGEST_SOCKET_TIMEOUT,
95+
FTL_INGEST_SERVER_TERMINATE,
9596
} ftl_status_t;
9697

9798
typedef enum {

libftl/ftl_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ ftl_status_t _set_ingest_hostname(ftl_stream_configuration_private_t *ftl) {
274274
#endif
275275
ftl->ingest_hostname = _strdup(ftl->param_ingest_hostname);
276276
} while (0);
277-
277+
278278
return ret_status;
279279
}
280280

0 commit comments

Comments
 (0)