Skip to content

Commit c81a4ab

Browse files
Add test
1 parent d2be487 commit c81a4ab

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/capi_track.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ static void sleep(unsigned int secs) { Sleep(secs * 1000); }
1919
#include <unistd.h> // for sleep
2020
#endif
2121

22+
#define BUFFER_SIZE 4096
23+
2224
typedef struct {
2325
rtcState state;
2426
rtcGatheringState gatheringState;
@@ -187,9 +189,25 @@ int test_capi_track_main() {
187189
goto error;
188190
}
189191

192+
// Test createOffer
193+
char buffer[BUFFER_SIZE];
194+
if (rtcCreateOffer(peer1->pc, buffer, BUFFER_SIZE) < 0) {
195+
fprintf(stderr, "rtcCreateOffer failed\n");
196+
goto error;
197+
}
198+
if (rtcGetLocalDescription(peer1->pc, buffer, BUFFER_SIZE) >= 0) {
199+
fprintf(stderr, "rtcCreateOffer has set the local description\n");
200+
goto error;
201+
}
202+
190203
// Initiate the handshake
191204
rtcSetLocalDescription(peer1->pc, NULL);
192205

206+
if (rtcGetLocalDescription(peer1->pc, buffer, BUFFER_SIZE) < 0) {
207+
fprintf(stderr, "rtcGetLocalDescription failed\n");
208+
goto error;
209+
}
210+
193211
attempts = 10;
194212
while ((!peer2->connected || !peer1->connected) && attempts--)
195213
sleep(1);

0 commit comments

Comments
 (0)