Clear idle buffers for input when stop decoder
authorJeongmo Yang <jm80.yang@samsung.com>
Fri, 7 Feb 2025 11:00:42 +0000 (20:00 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 7 Feb 2025 11:00:42 +0000 (20:00 +0900)
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
src/hal_backend_codec_v4l2.c

index d0ae4e42941c77566eaaf2e2b8d274417d2f3185..2a01889ed5638d5b769257d8ec38d95661148852 100644 (file)
@@ -1084,6 +1084,7 @@ static int __codec_v4l2_stop_stream(codec_hal_handle_s *handle)
 
        /* release input buffer */
        buffer_control = &handle->buffer_control[CODEC_HAL_BUFFER_CONTROL_TYPE_INPUT];
+       buffers = &buffer_control->buffers;
 
        for (i = 0 ; i < buffers->count ; i++) {
                codec_buffer = &buffers->buffer[i];
@@ -1103,6 +1104,8 @@ static int __codec_v4l2_stop_stream(codec_hal_handle_s *handle)
                codec_buffer->size = 0;
        }
 
+       g_queue_clear(buffers->idle_buffers);
+
        ret = __codec_v4l2_reqbufs(handle->device_fd,
                buffer_control->config.buf_type, V4L2_MEMORY_MMAP, 0, NULL);
        if (ret != HAL_CODEC_ERROR_NONE) {
@@ -1932,6 +1935,8 @@ int codec_v4l2_start(void *codec_handle, hal_codec_message_cb callback, void *us
                return HAL_CODEC_ERROR_INVALID_PARAMETER;
        }
 
+       LOGI("state[%d]", handle->state);
+
        locker = g_mutex_locker_new(&handle->lock);
 
        if (handle->state != HAL_CODEC_STATE_CONFIGURED) {
@@ -1963,7 +1968,7 @@ int codec_v4l2_start(void *codec_handle, hal_codec_message_cb callback, void *us
 
        handle->state = HAL_CODEC_STATE_STARTED;
 
-       LOGD("start codec[type:%d] done", handle->type);
+       LOGI("[type:%d] done", handle->type);
 
        return HAL_CODEC_ERROR_NONE;
 }
@@ -1980,7 +1985,7 @@ int codec_v4l2_stop(void *codec_handle)
                return HAL_CODEC_ERROR_INVALID_PARAMETER;
        }
 
-       LOGD("start");
+       LOGI("state[%d]", handle->state);
 
        locker = g_mutex_locker_new(&handle->lock);
 
@@ -2013,7 +2018,7 @@ int codec_v4l2_stop(void *codec_handle)
 
 _STOP_DONE:
        handle->is_stopping = FALSE;
-       LOGD("stop done [0x%x]", ret);
+       LOGI("stop done [0x%x]", ret);
 
        return ret;
 }
@@ -2146,6 +2151,8 @@ int codec_v4l2_decode(void *codec_handle, hal_codec_buffer_s *buffer)
 
        ret = __codec_v4l2_qbuf(handle->device_fd,
                buffer_control, idle_buffer);
+
+
        if (ret != HAL_CODEC_ERROR_NONE) {
                LOGE("QBUF[%p] failed[i:%d], 0x%x",
                        buffer, idle_buffer->index, ret);