Skip to content

Commit

Permalink
Get peer state by mqtt
Browse files Browse the repository at this point in the history
  • Loading branch information
sepfy committed Oct 14, 2023
1 parent 6cfde5a commit 1e5b5bf
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 141 deletions.
12 changes: 5 additions & 7 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
#endif

// siganling
#define HAVE_HTTP
#define HAVE_MQTT

#define MQTT_HOST "127.0.0.1"
#define MQTT_HOST "test.mosquitto.org"
#define MQTT_PORT 1883

#define WHIP_HOST "192.168.1.113"
#define WHIP_PATH "/whip/endpoint/ciao"
#define WHIP_PORT 7080
#define HAVE_MEDIASERVER
#define WHIP_HOST "127.0.0.1"
#define WHIP_PATH "/index/api/whip?app=live&stream=test"
#define WHIP_PORT 8081

#define KEEPALIVE_CONNCHECK 0

Expand Down
10 changes: 10 additions & 0 deletions src/peer_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ const char* peer_connection_state_to_string(PeerConnectionState state) {
}
}

PeerConnectionState peer_connection_get_state(PeerConnection *pc) {

return pc->state;
}

PeerConnection* peer_connection_create(PeerConfiguration *config) {

PeerConnection *pc = calloc(1, sizeof(PeerConnection));
Expand Down Expand Up @@ -219,6 +224,11 @@ void peer_connection_destroy(PeerConnection *pc) {
}
}

void peer_connection_close(PeerConnection *pc) {

pc->state = PEER_CONNECTION_CLOSED;
}

int peer_connection_send_audio(PeerConnection *pc, const uint8_t *buf, size_t len) {

if (pc->state != PEER_CONNECTION_COMPLETED) {
Expand Down
4 changes: 4 additions & 0 deletions src/peer_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ typedef struct PeerConnection PeerConnection;

const char* peer_connection_state_to_string(PeerConnectionState state);

PeerConnectionState peer_connection_get_state(PeerConnection *pc);

PeerConnection* peer_connection_create(PeerConfiguration *config);

void peer_connection_destroy(PeerConnection *pc);

void peer_connection_close(PeerConnection *pc);

int peer_connection_loop(PeerConnection *pc);
/**
* @brief send message to data channel
Expand Down
Loading

0 comments on commit 1e5b5bf

Please sign in to comment.