@@ -4602,6 +4602,28 @@ static gboolean janus_ice_outgoing_stats_handle(gpointer user_data) {
4602
4602
}
4603
4603
}
4604
4604
}
4605
+ #ifdef HAVE_SCTP
4606
+ /* Finally, send data stats */
4607
+ if (janus_flags_is_set (& handle -> webrtc_flags , JANUS_ICE_HANDLE_WEBRTC_DATA_CHANNELS )) {
4608
+ json_t * info = json_object ();
4609
+ json_object_set_new (info , "media" , json_string ("data" ));
4610
+ if (stream -> component ) {
4611
+ json_object_set_new (info , "packets-received" , json_integer (stream -> component -> in_stats .data .packets ));
4612
+ json_object_set_new (info , "packets-sent" , json_integer (stream -> component -> out_stats .data .packets ));
4613
+ json_object_set_new (info , "bytes-received" , json_integer (stream -> component -> in_stats .data .bytes ));
4614
+ json_object_set_new (info , "bytes-sent" , json_integer (stream -> component -> out_stats .data .bytes ));
4615
+ }
4616
+ /* Shall we send dedicated events per media or one per PeerConnection? */
4617
+ if (combine ) {
4618
+ if (combined_event == NULL )
4619
+ combined_event = json_array ();
4620
+ json_array_append_new (combined_event , info );
4621
+ } else {
4622
+ janus_events_notify_handlers (JANUS_EVENT_TYPE_MEDIA , JANUS_EVENT_SUBTYPE_MEDIA_STATS ,
4623
+ session -> session_id , handle -> handle_id , handle -> opaque_id , info );
4624
+ }
4625
+ }
4626
+ #endif
4605
4627
if (combined_event ) {
4606
4628
janus_events_notify_handlers (JANUS_EVENT_TYPE_MEDIA , JANUS_EVENT_SUBTYPE_MEDIA_STATS ,
4607
4629
session -> session_id , handle -> handle_id , handle -> opaque_id , combined_event );
0 commit comments