webrtc_display: Destroy tbm bo list when bo size has been changed 93/312693/2
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 13 Jun 2024 05:33:48 +0000 (14:33 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 13 Jun 2024 05:46:07 +0000 (14:46 +0900)
It is related to dynamic resolution change in case of EVAS rendering.
It has fixed the crash due to the invalid bo size when facing this case.

[Version] 0.4.56
[Issue Type] Bug fix

Change-Id: Idd0ef5467acf39ca667c5a6b41505858e12f06d2
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc_display.c
src/webrtc_tbm.c

index 232844ae2cc64662fa7e3fb251c7d8622c283709..c66cb4b772f6b47d98aa11a6b6cb1cbeb9afb946 100644 (file)
@@ -435,6 +435,7 @@ typedef struct _webrtc_tbm_s {
        GCond cond;
        GMutex mutex;
        GList *bo_list;    /* for decoded video data by sw codec */
+       int bo_size;
 } webrtc_tbm_s;
 
 typedef struct _webrtc_display {
@@ -912,6 +913,7 @@ int _release_all_resources(webrtc_s *webrtc);
 webrtc_tbm_s *_alloc_tbm(void);
 void _release_tbm(webrtc_tbm_s *tbm);
 void _create_tbm_bo_list(webrtc_tbm_s *tbm, int bo_size, int list_length);
+void _destroy_tbm_bo_list(webrtc_tbm_s *tbm);
 void *_get_unused_tbm_bo(webrtc_tbm_s *tbm, unsigned int timeout_sec);
 void _release_tbm_bo(webrtc_tbm_s *tbm, void *bo);
 
index e991a9d462c327bf3e537a42cadb440ba411021e..95994e499c9978f1c982b1ec73fdd47946d5583e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.4.55
+Version:    0.4.56
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index aa2e29257188e73c6bfab9341cfa8893e7eb8ca7..57bed31491c05cb71743d34ba8a00a943f0537ec 100644 (file)
@@ -369,6 +369,10 @@ static bool __swcodec_set_bo(webrtc_display_s *display, video_decoded_data_info_
                goto ERROR;
        }
 
+       if (display->tbm->bo_list &&
+               display->tbm->bo_size != info->bo_size)
+               _destroy_tbm_bo_list(display->tbm);
+
        if (display->tbm->bo_list == NULL) {
                LOG_DEBUG("MMPixelFormatType[%d]", info->format);
                _create_tbm_bo_list(display->tbm, info->bo_size, 10); /* FIXME: use ini file to get list length */
index 9f441307f579fb89665c1fbe41e3a2a0b62945e2..c076fcefa9b1dac95c1270615c18ae535c06112a 100644 (file)
@@ -37,7 +37,7 @@ static void __tbm_bo_destroy_cb(webrtc_tbm_bo_s *tbm_bo)
        g_free(tbm_bo);
 }
 
-static void __destroy_tbm_bo_list(webrtc_tbm_s *tbm)
+void _destroy_tbm_bo_list(webrtc_tbm_s *tbm)
 {
        g_autoptr(GMutexLocker) locker = NULL;
 
@@ -76,7 +76,10 @@ void _create_tbm_bo_list(webrtc_tbm_s *tbm, int bo_size, int list_length)
                LOG_DEBUG("bo[%p] is created", tbm_bo->bo);
                tbm->bo_list = g_list_append(tbm->bo_list, tbm_bo);
        }
-       LOG_DEBUG("tbm->bo_list[%p, length:%d] is created", tbm->bo_list, g_list_length(tbm->bo_list));
+       tbm->bo_size = bo_size;
+
+       LOG_INFO("tbm[bo_list[%p, length:%d], bo_size:%d] is created",
+               tbm->bo_list, g_list_length(tbm->bo_list), tbm->bo_size);
 }
 
 void *_get_unused_tbm_bo(webrtc_tbm_s *tbm, unsigned int timeout_sec)
@@ -159,7 +162,7 @@ void _release_tbm(webrtc_tbm_s *tbm)
 {
        RET_IF(tbm == NULL, "tbm is NULL");
 
-       __destroy_tbm_bo_list(tbm);
+       _destroy_tbm_bo_list(tbm);
 
        g_mutex_lock(&tbm->mutex);