-
Notifications
You must be signed in to change notification settings - Fork 45
Conversation
please help to review. |
@@ -159,6 +159,15 @@ int main(int argc, char** argv) | |||
fwrite(MVBuffer.data, MVBuffer.bufferSize, 1, MVFp); | |||
} | |||
#endif | |||
if (status == ENCODE_BUFFER_TOO_SMALL) { | |||
maxOutSize = (maxOutSize * 3) / 2; | |||
free(outputBuffer.data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ok to move this to createOutputBuffer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, accordingly, how about:
bool createOutputBuffer(VideoEncOutputBuffer* outputBuffer, int maxOutSize)
{
if(outputBuffer.data){
free(outputBuffer.data);
outputBuffer.data = NULL;
}
outputBuffer->data = static_cast<uint8_t*>(malloc(maxOutSize));
if (!outputBuffer->data)
return false;
outputBuffer->bufferSize = maxOutSize;
outputBuffer->format = OUTPUT_EVERYTHING;
return true;
}
?
Thanks @xuguangxin .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, and you do not need set "outputBuffer.data = NULL" since you will allocate the data later. Please check the outputBuffer, please make sure you memset the outputBuffer in main(), else free(outputBuffer.data) will crash your programe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, thanks @xuguangxin .
re-alloc a new bigger output buffer for the encoded picture size is larger than the default. Signed-off-by: wudping <dongpingx.wu@intel.com>
updated according to the suggestions, please help to review. |
re-alloc a new bigger output buffer for the encoded picture size is
larger than the default.
to fix issue #657
Signed-off-by: wudping dongpingx.wu@intel.com