Skip to content

Commit

Permalink
fixed issue with restarting piping that could overwrite our file due …
Browse files Browse the repository at this point in the history
…to corruption in mmeAviFile_t struct
  • Loading branch information
entdark committed Apr 4, 2016
1 parent 4b550ea commit fd37dfd
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions trunk/code/renderer/tr_mme_avi.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,12 @@ void mmeAviShot( mmeAviFile_t *aviFile, const char *name, mmeShotType_t type, in
outSize = SaveJPG( mme_jpegQuality->integer, width, height, type, inBuf, outBuf + 8, outSize );
}
aviWrite32( outBuf + 4, outSize );
aviFile->index[ aviFile->iframes ] = outSize;
aviFile->aindex[ aviFile->iframes ] = -1;
aviFile->frames++;
aviFile->iframes++;
if (!aviFile->pipe) {
aviFile->index[ aviFile->iframes ] = outSize;
aviFile->aindex[ aviFile->iframes ] = -1;
aviFile->frames++;
aviFile->iframes++;
}

outSize = (outSize + 9) & ~1; //make sure we align on 2 byte boundary, hurray M$
if (aviFile->format == 0 && type == mmeShotTypeBGR) {
Expand Down Expand Up @@ -503,10 +505,12 @@ void mmeAviSound( mmeAviFile_t *aviFile, const char *name, mmeShotType_t type, i
}

aviWrite32( outBuf + 4, size );
aviFile->index[ aviFile->iframes ] = size;
aviFile->aindex[ aviFile->iframes ] = size;
aviFile->aframes++;
aviFile->iframes++;
if (!aviFile->pipe) {
aviFile->index[ aviFile->iframes ] = size;
aviFile->aindex[ aviFile->iframes ] = size;
aviFile->aframes++;
aviFile->iframes++;
}

size = (size + 9) & ~1; //make sure we align on 2 byte boundary, hurray M$
if (aviFile->pipe) {
Expand Down

0 comments on commit fd37dfd

Please sign in to comment.