summaryrefslogtreecommitdiff
path: root/example/main.c
diff options
context:
space:
mode:
authorChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-23 01:14:00 -0700
committerChris Hiszpanski <chris.hiszpanski@verkada.com>2022-05-23 01:14:00 -0700
commit9175048aa48dee44946bdf1f10f47fe5b3e47675 (patch)
treec046260047cdaf8e62f61606b8525d9219cb4995 /example/main.c
parentb24176ea5328b76b246c519a469e62f53dbe8a69 (diff)
Rename from trtc_ to rtc_
Diffstat (limited to 'example/main.c')
-rw-r--r--example/main.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/example/main.c b/example/main.c
index 77b68da..a5f786c 100644
--- a/example/main.c
+++ b/example/main.c
@@ -18,9 +18,9 @@ static bool matches(const char *json, jsmntok_t *tok, const char *s) {
}
// Parses ICE candidate from stringified JSON
-struct trtc_ice_candidate_t parse_ice_candidate(const char *s)
+struct rtc_ice_candidate parse_ice_candidate(const char *s)
{
- struct trtc_ice_candidate_t c = { 0 };
+ struct rtc_ice_candidate c = { 0 };
int i, r;
jsmn_parser p;
@@ -61,7 +61,7 @@ struct trtc_ice_candidate_t parse_ice_candidate(const char *s)
}
// (callback) Called for each discovered local ICE candidate
-void on_ice_candidate(const struct trtc_ice_candidate_t c, void *arg) {
+void on_ice_candidate(const struct rtc_ice_candidate c, void *arg) {
// send ice candidate over signaling channel
printf("{"
"\"candidate\":\"%s\","
@@ -79,10 +79,10 @@ int main(int argc, char **argv)
setvbuf(stdout, NULL, _IONBF, 0);
// initialize tinyrtc library
- trtc_init();
+ rtc_init();
// create peer connection
- struct trtc_config_t cfg = {
+ struct rtc_configuration cfg = {
.ice_servers = {
{
.urls = {
@@ -91,13 +91,13 @@ int main(int argc, char **argv)
}
}
};
- struct trtc_peerconn_t* pc = trtc_peer_connection(cfg);
+ struct rtc_peer_connection* pc = rtc_peer_connection_create(cfg);
if (!pc) {
- syslog(LOG_ERR, "trtc_peer_connection() failed");
+ syslog(LOG_ERR, "rtc_peer_connection_create() failed");
return -1;
}
- trtc_set_on_ice_candidate(pc, on_ice_candidate, NULL);
+ rtc_set_on_ice_candidate(pc, on_ice_candidate, NULL);
while (true) {
int n;
@@ -112,18 +112,18 @@ int main(int argc, char **argv)
// case: sdp offer
if (strstr(msg, "\"sdp\"")) {
- // XXX trtc_set_remote_description(pc, offer);
- const char *answer = trtc_create_answer(pc);
+ // XXX rtc_set_remote_description(pc, offer);
+ const char *answer = rtc_create_answer(pc);
/* send SDP answer via stdout signaling channel */
printf("{\"sdp\":\"%s\",\"type\":\"answer\"}\n", answer);
- trtc_set_local_description(pc, answer);
+ rtc_set_local_description(pc, answer);
// case: ice candidate
} else if (strstr(msg, "\"candidate\"")) {
- struct trtc_ice_candidate_t c = parse_ice_candidate(msg);
- trtc_add_ice_candidate(pc, c);
+ struct rtc_ice_candidate c = parse_ice_candidate(msg);
+ rtc_add_ice_candidate(pc, c);
// case: error
} else {