diff --git a/src/common/avc/es_parser.cpp b/src/common/avc/es_parser.cpp index 1d55e09b6..760c16099 100644 --- a/src/common/avc/es_parser.cpp +++ b/src/common/avc/es_parser.cpp @@ -148,7 +148,7 @@ void es_parser_c::handle_slice_nalu(memory_cptr const &nalu, uint64_t nalu_pos) { if (!m_configuration_record_ready) { - m_unhandled_nalus.emplace_back(nalu, nalu_pos); + add_nalu_to_unhandled_nalus(nalu, nalu_pos); return; } diff --git a/src/common/avc_hevc/es_parser.cpp b/src/common/avc_hevc/es_parser.cpp index 76e521840..db5b8b5db 100644 --- a/src/common/avc_hevc/es_parser.cpp +++ b/src/common/avc_hevc/es_parser.cpp @@ -325,6 +325,13 @@ es_parser_c::build_frame_data() { } } +void +es_parser_c::add_nalu_to_unhandled_nalus(memory_cptr const &nalu, + uint64_t nalu_pos) { + nalu->take_ownership(); + m_unhandled_nalus.emplace_back(nalu, nalu_pos); +} + void es_parser_c::flush_unhandled_nalus() { for (auto const &nalu_with_pos : m_unhandled_nalus) diff --git a/src/common/avc_hevc/es_parser.h b/src/common/avc_hevc/es_parser.h index b90b92a62..781041a82 100644 --- a/src/common/avc_hevc/es_parser.h +++ b/src/common/avc_hevc/es_parser.h @@ -152,6 +152,7 @@ public: protected: void add_nalu_to_extra_data(memory_cptr const &nalu, extra_data_position_e position = extra_data_position_e::pre); void add_nalu_to_pending_frame_data(memory_cptr const &nalu); + void add_nalu_to_unhandled_nalus(memory_cptr const &nalu, uint64_t nalu_pos); void add_parameter_sets_to_extra_data(); void build_frame_data(); diff --git a/src/common/hevc/es_parser.cpp b/src/common/hevc/es_parser.cpp index 142ed7024..e05362054 100644 --- a/src/common/hevc/es_parser.cpp +++ b/src/common/hevc/es_parser.cpp @@ -98,7 +98,7 @@ void es_parser_c::handle_slice_nalu(memory_cptr const &nalu, uint64_t nalu_pos) { if (!m_configuration_record_ready) { - m_unhandled_nalus.emplace_back(nalu, nalu_pos); + add_nalu_to_unhandled_nalus(nalu, nalu_pos); return; }