When writing MP4 sample, save buffer.size() into a temporary variable before calling buffer.extract(). (#2628)

This commit is contained in:
Gleb Popov 2019-06-02 00:43:29 +04:00 committed by Isaac Connor
parent 7445f5588f
commit 1d132b5923
1 changed files with 4 additions and 3 deletions

View File

@ -458,11 +458,12 @@ int X264MP4Writer::x264encodeloop(bool bFlush) {
/* Write the sample */
if ( !buffer.empty() ) {
unsigned int bufSize = buffer.size();
if ( !MP4WriteSample(
mp4h,
mp4vtid,
buffer.extract(buffer.size()),
buffer.size(),
buffer.extract(bufSize),
bufSize,
duration,
offset,
prevKeyframe) ) {