Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sepfy committed Dec 16, 2024
1 parent 9135cde commit c52c9e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -29,15 +28,18 @@ 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
$ 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 <URL>
```
- Click Connect button on the website

### Examples for Platforms
- [ESP32](https://github.com/sepfy/libpeer/tree/main/examples/esp32): MJPEG over datachannel
Expand Down
16 changes: 7 additions & 9 deletions examples/generic/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <url> [-t <token>]\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;

Expand All @@ -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);
}
}

Expand All @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit c52c9e2

Please sign in to comment.