added release of copied buffers in host and hip (#126)

* added release of copied buffers in host and hip

* address review comments

* addressed review comment
This commit is contained in:
Rajy Rawther
2023-12-08 14:29:00 -08:00
committed by GitHub
parent 5d45ac6d92
commit 1dc5a9d798
+16
View File
@@ -72,6 +72,22 @@ RocVideoDecoder::~RocVideoDecoder() {
roc_decoder_ = nullptr;
}
std::lock_guard<std::mutex> lock(mtx_vp_frame_);
if (out_mem_type_ != OUT_SURFACE_MEM_DEV_INTERNAL) {
for (auto &p_frame : vp_frames_) {
if (p_frame.frame_ptr) {
if (out_mem_type_ == OUT_SURFACE_MEM_DEV_COPIED) {
hipError_t hip_status = hipFree(p_frame.frame_ptr);
if (hip_status != hipSuccess) {
std::cout << "ERROR: hipFree failed! (" << hip_status << ")" << std::endl;
}
}
else
delete[] (p_frame.frame_ptr);
p_frame.frame_ptr = nullptr;
}
}
}
if (hip_stream_) {
hipError_t hip_status = hipSuccess;
hip_status = hipStreamDestroy(hip_stream_);