This repository was archived by the owner on Apr 25, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ extern crate rand;
9
9
extern crate serde;
10
10
#[ macro_use]
11
11
extern crate serde_derive;
12
- #[ macro_use]
13
12
extern crate serde_json;
14
13
extern crate websocket;
15
14
#[ macro_use]
@@ -152,12 +151,10 @@ fn send_sdp_offer(app_control: &AppControl, offer: gst_webrtc::WebRTCSessionDesc
152
151
) {
153
152
return ;
154
153
}
155
- let message = json ! ( {
156
- "sdp" : {
157
- "type" : "offer" ,
158
- "sdp" : offer. get_sdp( ) . as_text( ) ,
159
- }
160
- } ) ;
154
+ let message = serde_json:: to_string ( & JsonMsg :: Sdp {
155
+ type_ : "offer" . to_string ( ) ,
156
+ sdp : offer. get_sdp ( ) . as_text ( ) . unwrap ( ) ,
157
+ } ) . unwrap ( ) ;
161
158
app_control. send_text_msg ( message. to_string ( ) ) ;
162
159
}
163
160
@@ -297,16 +294,13 @@ fn send_ice_candidate_message(app_control: &AppControl, values: &[glib::Value])
297
294
if !app_control. app_state_lt ( AppState :: PeerCallNegotiating , "Can't send ICE, not in call" ) {
298
295
return ;
299
296
}
300
-
301
297
let _webrtc = values[ 0 ] . get :: < gst:: Element > ( ) . expect ( "Invalid argument" ) ;
302
298
let mlineindex = values[ 1 ] . get :: < u32 > ( ) . expect ( "Invalid argument" ) ;
303
299
let candidate = values[ 2 ] . get :: < String > ( ) . expect ( "Invalid argument" ) ;
304
- let message = json ! ( {
305
- "ice" : {
306
- "candidate" : candidate,
307
- "sdpMLineIndex" : mlineindex,
308
- }
309
- } ) ;
300
+ let message = serde_json:: to_string ( & JsonMsg :: Ice {
301
+ candidate : candidate,
302
+ sdp_mline_index : mlineindex,
303
+ } ) . unwrap ( ) ;
310
304
app_control. send_text_msg ( message. to_string ( ) ) ;
311
305
}
312
306
You can’t perform that action at this time.
0 commit comments