Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed Jan 20, 2025
1 parent d2be487 commit c81a4ab
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/capi_track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ static void sleep(unsigned int secs) { Sleep(secs * 1000); }
#include <unistd.h> // for sleep
#endif

#define BUFFER_SIZE 4096

typedef struct {
rtcState state;
rtcGatheringState gatheringState;
Expand Down Expand Up @@ -187,9 +189,25 @@ int test_capi_track_main() {
goto error;
}

// Test createOffer
char buffer[BUFFER_SIZE];
if (rtcCreateOffer(peer1->pc, buffer, BUFFER_SIZE) < 0) {
fprintf(stderr, "rtcCreateOffer failed\n");
goto error;
}
if (rtcGetLocalDescription(peer1->pc, buffer, BUFFER_SIZE) >= 0) {
fprintf(stderr, "rtcCreateOffer has set the local description\n");
goto error;
}

// Initiate the handshake
rtcSetLocalDescription(peer1->pc, NULL);

if (rtcGetLocalDescription(peer1->pc, buffer, BUFFER_SIZE) < 0) {
fprintf(stderr, "rtcGetLocalDescription failed\n");
goto error;
}

attempts = 10;
while ((!peer2->connected || !peer1->connected) && attempts--)
sleep(1);
Expand Down

0 comments on commit c81a4ab

Please sign in to comment.