From: Jeongmo Yang Date: Fri, 7 Feb 2025 11:00:42 +0000 (+0900) Subject: Clear idle buffers for input when stop decoder X-Git-Tag: accepted/tizen/unified/20250610.081745~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1c4168989e1b6ab6fcc69fc00b485a155cda611;p=platform%2Fhal%2Fbackend%2Fcodec-v4l2.git Clear idle buffers for input when stop decoder Signed-off-by: Jeongmo Yang --- diff --git a/src/hal_backend_codec_v4l2.c b/src/hal_backend_codec_v4l2.c index d0ae4e4..2a01889 100644 --- a/src/hal_backend_codec_v4l2.c +++ b/src/hal_backend_codec_v4l2.c @@ -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);