From 33d6b37ddba1e1c098b21bd6a5995c04347e9423 Mon Sep 17 00:00:00 2001 From: jeffqjiangNew <142832361+jeffqjiangNew@users.noreply.github.com> Date: Tue, 2 Jan 2024 15:56:18 -0500 Subject: [PATCH] * rocDecode/HEVC: Fixed a bug in destroy data buffer function in VAAPI layer. (#150) - We have to clear the buffer id after destroying it. Without this clearing, we will encounter VAAPI buffer destroy failure on certain conformance streams where scaling list is signaled dynamically. In this case, we create different number of data buffers on different frames. If we do not clear the buffer id when destroying it, a dummy scaling list buffer id will have the same value as another buffer, resulting double destroy. --- src/rocdecode/vaapi/vaapi_videodecoder.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rocdecode/vaapi/vaapi_videodecoder.cpp b/src/rocdecode/vaapi/vaapi_videodecoder.cpp index 2dd9e63b51..040ada053f 100644 --- a/src/rocdecode/vaapi/vaapi_videodecoder.cpp +++ b/src/rocdecode/vaapi/vaapi_videodecoder.cpp @@ -175,15 +175,19 @@ rocDecStatus VaapiVideoDecoder::CreateContext() { rocDecStatus VaapiVideoDecoder::DestroyDataBuffers() { if (pic_params_buf_id_) { CHECK_VAAPI(vaDestroyBuffer(va_display_, pic_params_buf_id_)); + pic_params_buf_id_ = 0; } if (iq_matrix_buf_id_) { CHECK_VAAPI(vaDestroyBuffer(va_display_, iq_matrix_buf_id_)); + iq_matrix_buf_id_ = 0; } if (slice_params_buf_id_) { CHECK_VAAPI(vaDestroyBuffer(va_display_, slice_params_buf_id_)); + slice_params_buf_id_ = 0; } if (slice_data_buf_id_) { CHECK_VAAPI(vaDestroyBuffer(va_display_, slice_data_buf_id_)); + slice_data_buf_id_ = 0; } return ROCDEC_SUCCESS; }