From ca1c6b59b757544d889f6cedb1ee3274e5bbd260 Mon Sep 17 00:00:00 2001 From: jeffqjiangNew <142832361+jeffqjiangNew@users.noreply.github.com> Date: Tue, 27 Feb 2024 09:03:29 -0500 Subject: [PATCH] * rocDecode/AVC: Added error handling for no slice data cases. (#261) - At the end of some streams, the demuxer sends a picture payload of NAL units that do not contain slice data. In such cases, we return gracefully without causing a decoder error. [ROCm/rocdecode commit: 244eb517ab86e39afefffd990b568a9fc908d6ac] --- projects/rocdecode/src/parser/avc_parser.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/projects/rocdecode/src/parser/avc_parser.cpp b/projects/rocdecode/src/parser/avc_parser.cpp index dda123d977..20dfb0bb27 100644 --- a/projects/rocdecode/src/parser/avc_parser.cpp +++ b/projects/rocdecode/src/parser/avc_parser.cpp @@ -75,6 +75,11 @@ rocDecStatus AvcVideoParser::ParseVideoData(RocdecSourceDataPacket *p_data) { SendSeiMsgPayload(); } + // Error handling: if there is no slice data, return gracefully. + if (num_slices_ == 0) { + return ROCDEC_SUCCESS; + } + // Decode the picture if (SendPicForDecode() != PARSER_OK) { ERR(STR("Failed to decode!")); @@ -2607,11 +2612,13 @@ void AvcVideoParser::PrintDpb() { MSG("Frame buffer " << i << ": pic_idx = " << p_buf->pic_idx << ", pic_structure = " << p_buf->pic_structure << ", pic_order_cnt = " << p_buf->pic_order_cnt << ", top_field_order_cnt = " << p_buf->top_field_order_cnt << ", bottom_field_order_cnt = " << p_buf->bottom_field_order_cnt << ", frame_num = " << p_buf->frame_num << ", frame_num_wrap = " << p_buf->frame_num_wrap << ", pic_num = " << p_buf->pic_num << ", long_term_pic_num = " << p_buf->long_term_pic_num << ", long_term_frame_idx = " << p_buf->long_term_frame_idx << ", is_reference = " << p_buf->is_reference << ", use_status = " << p_buf->use_status << ", pic_output_flag = " << p_buf->pic_output_flag); } MSG(""); - MSG("output_pic_list:"); - for (i = 0; i < dpb_buffer_.num_output_pics; i++) { - MSG_NO_NEWLINE(dpb_buffer_.output_pic_list[i] << ", "); - } + if (dpb_buffer_.num_output_pics) { + MSG("output_pic_list:"); + for (i = 0; i < dpb_buffer_.num_output_pics; i++) { + MSG_NO_NEWLINE(dpb_buffer_.output_pic_list[i] << ", "); + } MSG(""); + } } void AvcVideoParser::PrintVappiBufInfo() {