Bug fix for incorrect audio and video chunk size. Data pad should not be included in the ckSize field.

This commit is contained in:
mjbudd77 2021-08-29 15:36:02 -04:00
parent 4e1b5873b9
commit 04aa7afb1f
1 changed files with 4 additions and 2 deletions

View File

@ -309,7 +309,9 @@ gwavi_t::add_frame( unsigned char *buffer, size_t len)
maxi_pad = len % WORD_SIZE; maxi_pad = len % WORD_SIZE;
if (maxi_pad > 0) if (maxi_pad > 0)
{
maxi_pad = WORD_SIZE - maxi_pad; maxi_pad = WORD_SIZE - maxi_pad;
}
if (offset_count >= offsets_len) if (offset_count >= offsets_len)
{ {
@ -336,7 +338,7 @@ gwavi_t::add_frame( unsigned char *buffer, size_t len)
"failed\n"); "failed\n");
return -1; return -1;
} }
if (write_int(out, (unsigned int)(len + maxi_pad)) == -1) { if (write_int(out, (unsigned int)(len)) == -1) {
(void)fprintf(stderr, "gwavi_add_frame: write_int() failed\n"); (void)fprintf(stderr, "gwavi_add_frame: write_int() failed\n");
return -1; return -1;
} }
@ -411,7 +413,7 @@ gwavi_t::add_audio( unsigned char *buffer, size_t len)
"failed\n"); "failed\n");
return -1; return -1;
} }
if (write_int(out,(unsigned int)(len + maxi_pad)) == -1) { if (write_int(out,(unsigned int)(len)) == -1) {
(void)fprintf(stderr, "gwavi_add_audio: write_int() failed\n"); (void)fprintf(stderr, "gwavi_add_audio: write_int() failed\n");
return -1; return -1;
} }