Open HelpMeHelpYou opened 1 month ago
@HelpMeHelpYou Why don't you modify "ReadEncodedStream()" to reset file pointer in util.hpp? Something like this,
mfxStatus ReadEncodedStream(mfxBitstream &bs, FILE *f) {
mfxU8 *p0 = bs.Data;
mfxU8 *p1 = bs.Data + bs.DataOffset;
if (bs.DataOffset > bs.MaxLength - 1) {
return MFX_ERR_NOT_ENOUGH_BUFFER;
}
if (bs.DataLength + bs.DataOffset > bs.MaxLength) {
return MFX_ERR_NOT_ENOUGH_BUFFER;
}
for (mfxU32 i = 0; i < bs.DataLength; i++) {
*(p0++) = *(p1++);
}
bs.DataOffset = 0;
do {
bs.DataLength += (mfxU32)fread(bs.Data + bs.DataLength, 1, bs.MaxLength - bs.DataLength, f);
if (bs.DataLength == 0) {
if (fseek(f, 0, SEEK_SET) != 0) {
printf("Error SEEK_SET 0\n");
exit(1);
}
printf("\nSEEK_SET 0\n");
}
} while (bs.DataLength == 0)
return MFX_ERR_NONE;
}
@shepark Hello, thank for paying attention. Your snippet is pretty good. I think It'easy to understand how we make the bug more visible with your code. But still the bug is reproducible.
There is a memory leak. System info.
Steps to reproduce: compile hello_decode and run it.
If you are still not sure apply the patch to loop the source:
Watch umlimited memroy consumption (VmRss)