Bug fix: Reset buffer size when start
authorJeongmo Yang <jm80.yang@samsung.com>
Mon, 10 Feb 2025 11:46:32 +0000 (20:46 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Mon, 10 Feb 2025 11:46:32 +0000 (20:46 +0900)
- The buffer size will be increased while playing DRC contents,
  it causes segmentation fault when stop codec.

Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
src/hal_backend_codec_v4l2.c

index 2a01889ed5638d5b769257d8ec38d95661148852..9e23454ba3db467782a199d9d6ea6bad04ec0bb2 100644 (file)
@@ -647,6 +647,7 @@ static int __codec_v4l2_s_fmt(codec_hal_buffer_control_s *buffer_control, int de
        }
 
        if (V4L2_TYPE_IS_MULTIPLANAR(codec_config->buf_type)) {
+               codec_config->buffer_size = 0;
                for (i = 0 ; i < v4l2_fmt.fmt.pix_mp.num_planes ; i++) {
                        LOGI("[%s] plane[%d] size [%u]", BUFFER_CONTROL_TYPE_STRING(type),
                                i, v4l2_fmt.fmt.pix_mp.plane_fmt[i].sizeimage);
@@ -1968,7 +1969,7 @@ int codec_v4l2_start(void *codec_handle, hal_codec_message_cb callback, void *us
 
        handle->state = HAL_CODEC_STATE_STARTED;
 
-       LOGI("[type:%d] done", handle->type);
+       LOGI("[type:%d] done, buffer thread[%p]", handle->type, handle->buffer_handler);
 
        return HAL_CODEC_ERROR_NONE;
 }
@@ -2003,7 +2004,7 @@ int codec_v4l2_stop(void *codec_handle)
                goto _STOP_DONE;
        }
 
-       LOGI("join buffer thread");
+       LOGI("join buffer thread[%p]", handle->buffer_handler);
 
        if (handle->buffer_handler) {
                g_mutex_lock(&handle->buffer_control[CODEC_HAL_BUFFER_CONTROL_TYPE_OUTPUT].lock);