webrtc_stats: Add null check code before calling gst_structure_foreach() 82/287882/1
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 1 Feb 2023 08:51:01 +0000 (17:51 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Tue, 7 Feb 2023 09:26:58 +0000 (18:26 +0900)
It is to avoid printing warning message from a console.

[Version] 0.3.285
[Issue type] Improvement

Change-Id: I52f0c9ad3f7c218b5af9d70706625a1e7848fcbb

packaging/capi-media-webrtc.spec
src/webrtc_stats.c

index e9889e5de1b8a25e6237545ac48bb4796dca99c0..26ec27fc6dd46c1043a9552fbd2f6c6570ed5834 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.284
+Version:    0.3.285
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 8b9d1f8cf3cedde16846ea2cafae92284da6e3da..6f256e497d6223c290ecf1f11d7f6ce013538c7c 100644 (file)
@@ -485,12 +485,16 @@ static void __stats_inbound_rtp_invoke_callback(const GstStructure *s, webrtc_st
                NULL);
 
        stats_userdata.export = false; /* to skip invoking callback stats below */
-       LOG_DEBUG("gst-rtpjitterbuffer-stats ---> ");
-       gst_structure_foreach(rtpjitterbuffer_stats, __stats_field_foreach_cb, &stats_userdata);
+       if (rtpjitterbuffer_stats) {
+               LOG_DEBUG("gst-rtpjitterbuffer-stats ---> ");
+               gst_structure_foreach(rtpjitterbuffer_stats, __stats_field_foreach_cb, &stats_userdata);
+       }
        if (user_data->exit)
                return;
-       LOG_DEBUG("gst-rtpsource-stats ---> ");
-       gst_structure_foreach(rtpsource_stats, __stats_field_foreach_cb, &stats_userdata);
+       if (rtpsource_stats) {
+               LOG_DEBUG("gst-rtpsource-stats ---> ");
+               gst_structure_foreach(rtpsource_stats, __stats_field_foreach_cb, &stats_userdata);
+       }
 }
 
 static void __stats_outbound_rtp_invoke_callback(const GstStructure *s, webrtc_stats_type_e type, stats_field_s **fields_list, promise_userdata_s *user_data)
@@ -508,8 +512,10 @@ static void __stats_outbound_rtp_invoke_callback(const GstStructure *s, webrtc_s
 
        stats_userdata.export = false; /* to skip invoking callback stats below */
        gst_structure_get(s, "gst-rtpsource-stats", GST_TYPE_STRUCTURE, &rtpsource_stats, NULL);
-       LOG_DEBUG("gst-rtpsource-stats ---> ");
-       gst_structure_foreach(rtpsource_stats, __stats_field_foreach_cb, &stats_userdata);
+       if (rtpsource_stats) {
+               LOG_DEBUG("gst-rtpsource-stats ---> ");
+               gst_structure_foreach(rtpsource_stats, __stats_field_foreach_cb, &stats_userdata);
+       }
 }
 
 static void __stats_remote_inbound_rtp_invoke_callback(const GstStructure *s, webrtc_stats_type_e type, stats_field_s **fields_list, promise_userdata_s *user_data)
@@ -519,7 +525,6 @@ static void __stats_remote_inbound_rtp_invoke_callback(const GstStructure *s, we
 
        LOG_DEBUG_ENTER();
 
-       /* FIXME: type of 'packets-lost(int)' should be fixed.*/
        gst_structure_foreach(s, __stats_field_foreach_cb, &stats_userdata);
 }