|
@@ -1,5 +1,5 @@
|
|
|
|
|
|
- #include <rtc/rtc.h>
|
|
|
|
|
|
+#include <rtc/rtc.h>
|
|
|
|
|
|
#include <stdbool.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
@@ -87,15 +87,14 @@ int main(int argc, char **argv) {
|
|
"[Command]: ");
|
|
"[Command]: ");
|
|
|
|
|
|
int command = -1;
|
|
int command = -1;
|
|
- int c;
|
|
|
|
- // int check_can
|
|
|
|
|
|
+ int c;
|
|
|
|
+ // int check_scan
|
|
if (scanf("%d", &command)){
|
|
if (scanf("%d", &command)){
|
|
-
|
|
|
|
|
|
|
|
}else {
|
|
}else {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- while ((c = getchar()) != '\n' && c != EOF) { }
|
|
|
|
|
|
+ while ((c = getchar()) != '\n' && c != EOF) { }
|
|
|
|
|
|
fflush(stdin);
|
|
fflush(stdin);
|
|
switch (command) {
|
|
switch (command) {
|
|
@@ -106,8 +105,7 @@ int main(int argc, char **argv) {
|
|
case 1: {
|
|
case 1: {
|
|
// Parse Description
|
|
// Parse Description
|
|
printf("[Description]: ");
|
|
printf("[Description]: ");
|
|
- char c;
|
|
|
|
- while ((c = getchar()) != '\n' && c != EOF) { }
|
|
|
|
|
|
+
|
|
|
|
|
|
char *line = NULL;
|
|
char *line = NULL;
|
|
size_t len = 0;
|
|
size_t len = 0;
|
|
@@ -131,9 +129,9 @@ int main(int argc, char **argv) {
|
|
printf("[Candidate]: ");
|
|
printf("[Candidate]: ");
|
|
char* candidate = NULL;
|
|
char* candidate = NULL;
|
|
size_t candidate_size = 0;
|
|
size_t candidate_size = 0;
|
|
- int c;
|
|
|
|
|
|
+
|
|
if(getline(&candidate, &candidate_size, stdin)){
|
|
if(getline(&candidate, &candidate_size, stdin)){
|
|
- rtcAddRemoteCandidate(peer->pc, candidate, "1");
|
|
|
|
|
|
+ rtcAddRemoteCandidate(peer->pc, candidate, "0");
|
|
free(candidate);
|
|
free(candidate);
|
|
|
|
|
|
}else {
|
|
}else {
|
|
@@ -152,7 +150,7 @@ int main(int argc, char **argv) {
|
|
printf("[Message]: ");
|
|
printf("[Message]: ");
|
|
char* message = NULL;
|
|
char* message = NULL;
|
|
size_t message_size = 0;
|
|
size_t message_size = 0;
|
|
- int c;
|
|
|
|
|
|
+
|
|
if(getline(&message, &message_size, stdin)){
|
|
if(getline(&message, &message_size, stdin)){
|
|
rtcSendMessage(peer->dc, message, -1);
|
|
rtcSendMessage(peer->dc, message, -1);
|
|
free(message);
|
|
free(message);
|
|
@@ -230,7 +228,11 @@ static void closedCallback(void *ptr) {
|
|
Peer *peer = (Peer *)ptr;
|
|
Peer *peer = (Peer *)ptr;
|
|
peer->connected = false;
|
|
peer->connected = false;
|
|
|
|
|
|
-
|
|
|
|
|
|
+ // char buffer[256];
|
|
|
|
+
|
|
|
|
+ // if (rtcGetDataChannelLabel(peer->dc, buffer, 256) >= 0)
|
|
|
|
+ // printf("DataChannel %s: Received with label \"%s\"\n","answerer", buffer);
|
|
|
|
+ //
|
|
}
|
|
}
|
|
static void messageCallback(const char *message, int size, void *ptr) {
|
|
static void messageCallback(const char *message, int size, void *ptr) {
|
|
// Peer *peer = (Peer *)ptr;
|
|
// Peer *peer = (Peer *)ptr;
|