From c52c9e20e6dd640c16e11a352bbcbaee4f6f3bda Mon Sep 17 00:00:00 2001 From: sepfy Date: Mon, 16 Dec 2024 21:30:25 +0800 Subject: [PATCH] Update README.md --- README.md | 6 ++++-- examples/generic/main.c | 16 +++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 9dd0bc9..0d815eb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # libpeer - Portable WebRTC Library for IoT/Embedded Device ![build](https://github.com/sepfy/pear/actions/workflows/build.yml/badge.svg) -[![Discord](https://img.shields.io/discord/1265486725967253667?logo=discord)](https://discord.gg/AsPgabeS67) libpeer is a WebRTC implementation written in C, developed with BSD socket. The library aims to integrate IoT/Embedded device video/audio streaming with WebRTC, such as ESP32 and Raspberry Pi @@ -29,6 +28,8 @@ libpeer is a WebRTC implementation written in C, developed with BSD socket. The * [coreMQTT](https://github.com/FreeRTOS/coreMQTT) ### Getting Started with Generic Example +- Copy URL from the test [website](https://sepfy.github.io/libpeer) +- Build and run the example ```bash $ sudo apt -y install git cmake $ git clone --recursive https://github.com/sepfy/libpeer @@ -36,8 +37,9 @@ $ cd libpeer $ cmake -S . -B build && cmake --build build $ wget http://www.live555.com/liveMedia/public/264/test.264 # Download test video file $ wget https://mauvecloud.net/sounds/alaw08m.wav # Download test audio file -$ ./generic/sample/sample +$ ./examples/generic/sample -u ``` +- Click Connect button on the website ### Examples for Platforms - [ESP32](https://github.com/sepfy/libpeer/tree/main/examples/esp32): MJPEG over datachannel diff --git a/examples/generic/main.c b/examples/generic/main.c index ef2c88a..2e3e7ff 100644 --- a/examples/generic/main.c +++ b/examples/generic/main.c @@ -60,12 +60,11 @@ static uint64_t get_timestamp() { return tv.tv_sec * 1000 + tv.tv_usec / 1000; } -void print_usage(const char *prog_name) { +void print_usage(const char* prog_name) { printf("Usage: %s -u [-t ]\n", prog_name); } -void parse_arguments(int argc, char *argv[], const char **url, const char **token) { - +void parse_arguments(int argc, char* argv[], const char** url, const char** token) { *token = NULL; *url = NULL; @@ -75,8 +74,8 @@ void parse_arguments(int argc, char *argv[], const char **url, const char **toke } else if (strcmp(argv[i], "-t") == 0 && (i + 1) < argc) { *token = argv[++i]; } else { - print_usage(argv[0]); - exit(1); + print_usage(argv[0]); + exit(1); } } @@ -89,8 +88,8 @@ void parse_arguments(int argc, char *argv[], const char **url, const char **toke int main(int argc, char* argv[]) { uint64_t curr_time, video_time, audio_time; uint8_t buf[102400]; - const char *url = NULL; - const char *token = NULL; + const char* url = NULL; + const char* token = NULL; int size; pthread_t peer_singaling_thread; @@ -106,8 +105,7 @@ int main(int argc, char* argv[]) { }, .datachannel = DATA_CHANNEL_STRING, .video_codec = CODEC_H264, - .audio_codec = CODEC_PCMA - }; + .audio_codec = CODEC_PCMA}; printf("=========== Parsed Arguments ===========\n"); printf(" %-5s : %s\n", "URL", url);