test: Add missing lock 98/304198/1 accepted/tizen/7.0/unified/20240112.160320
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 11 Jan 2024 07:19:49 +0000 (16:19 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 12 Jan 2024 01:29:55 +0000 (10:29 +0900)
[Version] 0.3.300
[Issue Type] Coverity defect (MISSING_LOCK)

Change-Id: Id969572e1896b660b620216ecb376a43d4a891fd
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
test/webrtc_test.c

index 78427a316c10703d89c248d6a99fb3e02afb0c4c..fce36fa3f66de7ac712c013c3e428c732c51408b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.299
+Version:    0.3.300
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 80641cabed9f77236a8f1da101c6b2e66026864e..a1bcf9e27cb2ea219d2ba3840aa1b5d39fcda69e 100644 (file)
@@ -2229,9 +2229,9 @@ static void __media_packet_source_buffer_state_changed_cb(unsigned int source_id
        }
        g_mutex_lock(&conn->packet_sources[i].mutex);
        conn->packet_sources[i].is_overflowed = (state == WEBRTC_MEDIA_PACKET_SOURCE_BUFFER_STATE_OVERFLOW);
-       g_mutex_unlock(&conn->packet_sources[i].mutex);
        if (!conn->packet_sources[i].is_overflowed)
                g_cond_signal(&conn->packet_sources[i].cond);
+       g_mutex_unlock(&conn->packet_sources[i].mutex);
 }
 
 static void _webrtc_media_packet_source_set_buffer_state_changed_cb(int index, unsigned int source_id)
@@ -3015,8 +3015,10 @@ static void _stop_pushing_packet(int index, int source_id)
 
        RET_IF(!g_ad.conns[index].packet_sources[i].src_pipeline, "already stopped for pushing packet");
 
+       g_mutex_lock(&g_ad.conns[index].packet_sources[i].mutex);
        if (g_ad.conns[index].packet_sources[i].is_overflowed)
                g_cond_signal(&g_ad.conns[index].packet_sources[i].cond);
+       g_mutex_unlock(&g_ad.conns[index].packet_sources[i].mutex);
 
        g_ad.conns[index].packet_sources[i].is_stop_requested = true;