Skip to content

Commit

Permalink
NativeHandler: tweak signaling to support both JSON and SDP messages
Browse files Browse the repository at this point in the history
Closes #68.
  • Loading branch information
alessandrod authored and superdump committed May 12, 2016
1 parent 4cc1c38 commit c1f7faa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions SDK/OpenWebRTCNativeHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
- (void)terminateCall;
- (void)enableTrickleICE;

- (void)handleOfferReceived:(NSString *)offer;
- (void)handleAnswerReceived:(NSString *)answer;
- (void)handleOfferReceived:(NSDictionary *)offer;
- (void)handleAnswerReceived:(NSDictionary *)answer;
- (void)handleRemoteCandidateReceived:(NSDictionary *)candidate;

- (void)setVideoCaptureSourceByName:(NSString *)name;
Expand Down
18 changes: 12 additions & 6 deletions SDK/OpenWebRTCNativeHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,13 @@ - (void)terminateCall
reset();
}

- (void)handleAnswerReceived:(NSString *)answer
- (void)handleAnswerReceived:(NSDictionary *)answer
{
NSDictionary *sdp = [OpenWebRTCUtils parseSDPFromString:answer];
NSLog(@"Parsed Answer SDP: %@", sdp);
NSDictionary *sdp = answer[@"sessionDescription"];
if (!sdp)
sdp = [OpenWebRTCUtils parseSDPFromString:answer[@"sdp"]];

NSLog(@"Answer SDP: %@", sdp);

const gchar *mtype;
OwrMediaType media_type = OWR_MEDIA_TYPE_UNKNOWN;
Expand Down Expand Up @@ -353,13 +356,16 @@ - (NSMutableArray *)remoteCandidatesCache
return _remoteCandidatesCache;
}

- (void)handleOfferReceived:(NSString *)offer
- (void)handleOfferReceived:(NSDictionary *)offer
{
is_answering = TRUE;
is_offering = FALSE;

NSDictionary *sdp = [OpenWebRTCUtils parseSDPFromString:offer];
NSLog(@"Parsed Offer SDP: %@", sdp);
NSDictionary *sdp = offer[@"sessionDescription"];
if (!sdp)
sdp = [OpenWebRTCUtils parseSDPFromString:offer[@"sdp"]];

NSLog(@"Offer SDP: %@", sdp);

const gchar *mtype;
OwrMediaType media_type = OWR_MEDIA_TYPE_UNKNOWN;
Expand Down

0 comments on commit c1f7faa

Please sign in to comment.