Fixed the MD5 calculation error on some streams when both decoded output dumping and MD5 generation are on. (#607)

* * Fixed the MD5 calculation error on some streams when both decoded output dumping and MD5 generation are on.
 - The issue is with the final flushing of the remaining frames at the end of stream, where MD5 update is skipped when output dumping is on.

* * Minor format changes.

---------

Co-authored-by: Aryan Salmanpour <aryan.salmanpour@amd.com>
This commit is contained in:
jeffqjiangNew
2025-06-30 10:24:05 -04:00
committed by GitHub
parent 23c17cc150
commit aad9c248bd
7 changed files with 40 additions and 37 deletions
@@ -93,9 +93,9 @@ For example, the reconfiguration structs are defined in |common|_ in the rocDeco
.. code:: C++
typedef enum ReconfigFlushMode_enum {
RECONFIG_FLUSH_MODE_NONE = 0, /**< Just flush to get the frame count */
RECONFIG_FLUSH_MODE_DUMP_TO_FILE = 1, /**< The remaining frames will be dumped to file in this mode */
RECONFIG_FLUSH_MODE_CALCULATE_MD5 = 2, /**< Calculate the MD5 of the flushed frames */
RECONFIG_FLUSH_MODE_NONE = 0x0, /**< Just flush to get the frame count */
RECONFIG_FLUSH_MODE_DUMP_TO_FILE = 0x1, /**< The remaining frames will be dumped to file in this mode */
RECONFIG_FLUSH_MODE_CALCULATE_MD5 = (0x1 << 1), /**< Calculate the MD5 of the flushed frames */
} ReconfigFlushMode;
typedef struct ReconfigDumpFileStruct_t {
@@ -108,10 +108,12 @@ For example, the reconfiguration structs are defined in |common|_ in the rocDeco
reconfig_params.p_fn_reconfigure_flush = ReconfigureFlushCallback;
reconfig_user_struct.b_dump_frames_to_file = dump_output_frames;
reconfig_user_struct.output_file_name = output_file_path;
reconfig_params.reconfig_flush_mode = RECONFIG_FLUSH_MODE_NONE;
if (dump_output_frames) {
reconfig_params.reconfig_flush_mode = RECONFIG_FLUSH_MODE_DUMP_TO_FILE;
} else {
reconfig_params.reconfig_flush_mode = RECONFIG_FLUSH_MODE_NONE;
reconfig_params.reconfig_flush_mode |= RECONFIG_FLUSH_MODE_DUMP_TO_FILE;
}
if (b_generate_md5) {
reconfig_params.reconfig_flush_mode |= RECONFIG_FLUSH_MODE_CALCULATE_MD5;
}
reconfig_params.p_reconfig_user_struct = &reconfig_user_struct;
viddec.SetReconfigParams(&reconfig_params);
@@ -133,9 +133,9 @@ The reconfiguration structs are defined in |common|_ in the rocDecode samples. T
.. code:: C++
typedef enum ReconfigFlushMode_enum {
RECONFIG_FLUSH_MODE_NONE = 0, /**< Just flush to get the frame count */
RECONFIG_FLUSH_MODE_DUMP_TO_FILE = 1, /**< The remaining frames will be dumped to file in this mode */
RECONFIG_FLUSH_MODE_CALCULATE_MD5 = 2, /**< Calculate the MD5 of the flushed frames */
RECONFIG_FLUSH_MODE_NONE = 0x0, /**< Just flush to get the frame count */
RECONFIG_FLUSH_MODE_DUMP_TO_FILE = 0x1, /**< The remaining frames will be dumped to file in this mode */
RECONFIG_FLUSH_MODE_CALCULATE_MD5 = (0x1 << 1), /**< Calculate the MD5 of the flushed frames */
} ReconfigFlushMode;
typedef struct ReconfigDumpFileStruct_t {
@@ -152,12 +152,12 @@ If the ``-o`` output file path argument was set, the remaining frames in the dec
reconfig_params.p_fn_reconfigure_flush = ReconfigureFlushCallback;
reconfig_user_struct.b_dump_frames_to_file = dump_output_frames;
reconfig_user_struct.output_file_name = output_file_path;
reconfig_params.reconfig_flush_mode = RECONFIG_FLUSH_MODE_NONE;
if (dump_output_frames) {
reconfig_params.reconfig_flush_mode = RECONFIG_FLUSH_MODE_DUMP_TO_FILE;
} else if (b_generate_md5) {
reconfig_params.reconfig_flush_mode = RECONFIG_FLUSH_MODE_CALCULATE_MD5;
} else {
reconfig_params.reconfig_flush_mode = RECONFIG_FLUSH_MODE_NONE;
reconfig_params.reconfig_flush_mode |= RECONFIG_FLUSH_MODE_DUMP_TO_FILE;
}
if (b_generate_md5) {
reconfig_params.reconfig_flush_mode |= RECONFIG_FLUSH_MODE_CALCULATE_MD5;
}
reconfig_params.p_reconfig_user_struct = &reconfig_user_struct;