Fix a segmentation fault on some samples when the memory type is 3 (OUT_SURFACE_MEM_NOT_MAPPED) and attempting to save the output (which is not supported) (#239)

* Fix a segmentation fault on some samples when the memory type is 3 (OUT_SURFACE_MEM_NOT_MAPPED) and attempting to save the output (which is not supported)

* update the videoDecodeMultiFiles sample

* update the readme for videoDecodeMultiFiles

* add comments

* use OUT_SURFACE_MEM_NOT_MAPPED instead of integer number 3

[ROCm/rocdecode commit: 31c7c7c104]
Этот коммит содержится в:
Aryan Salmanpour
2024-02-12 16:50:17 -05:00
коммит произвёл GitHub
родитель 18e32ff6c8
Коммит bc48060ff0
8 изменённых файлов: 30 добавлений и 19 удалений
+9 -2
Просмотреть файл
@@ -76,7 +76,7 @@ void ShowHelpAndExit(const char *option = NULL) {
<< "-sei extract SEI messages; optional;" << std::endl
<< "-crop crop rectangle for output (not used when using interopped decoded frame); optional; default: 0" << std::endl
<< "-m output_surface_memory_type - decoded surface memory; optional; default - 0"
<< " [0 : OUT_SURFACE_MEM_DEV_INTERNAL/ 1 : OUT_SURFACE_MEM_DEV_COPIED/ 2 : OUT_SURFACE_MEM_HOST_COPIED]" << std::endl;
<< " [0 : OUT_SURFACE_MEM_DEV_INTERNAL/ 1 : OUT_SURFACE_MEM_DEV_COPIED/ 2 : OUT_SURFACE_MEM_HOST_COPIED/ 3 : OUT_SURFACE_MEM_NOT_MAPPED]" << std::endl;
exit(0);
}
@@ -195,7 +195,7 @@ int main(int argc, char **argv) {
}
for (int i = 0; i < n_frame_returned; i++) {
pframe = viddec.GetFrame(&pts);
if (dump_output_frames) {
if (dump_output_frames && mem_type != OUT_SURFACE_MEM_NOT_MAPPED) {
viddec.SaveFrameToFile(output_file_path, pframe, surf_info);
}
// release frame
@@ -208,6 +208,13 @@ int main(int argc, char **argv) {
if (!dump_output_frames) {
std::cout << "info: avg decoding time per frame (ms): " << total_dec_time / n_frame << std::endl;
std::cout << "info: avg FPS: " << (n_frame / total_dec_time) * 1000 << std::endl;
} else {
if (mem_type == OUT_SURFACE_MEM_NOT_MAPPED) {
std::cout << "info: saving frames with -m 3 option is not supported!" << std::endl;
} else {
std::cout << "info: saved frames into " << output_file_path << std::endl;
}
}
} catch (const std::exception &ex) {
std::cout << ex.what() << std::endl;