When writing MP4 sample, save buffer.size() into a temporary variable before calling buffer.extract(). (#2628)
This commit is contained in:
parent
7445f5588f
commit
1d132b5923
|
@ -101,7 +101,7 @@ X264MP4Writer::X264MP4Writer(
|
||||||
Error("Failed init swscaleobj");
|
Error("Failed init swscaleobj");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
swscaleobj.SetDefaults(zm_pf, codec_pf, width, height);
|
swscaleobj.SetDefaults(zm_pf, codec_pf, width, height);
|
||||||
|
|
||||||
/* Calculate the image sizes. We will need this for parameter checking */
|
/* Calculate the image sizes. We will need this for parameter checking */
|
||||||
|
@ -458,11 +458,12 @@ int X264MP4Writer::x264encodeloop(bool bFlush) {
|
||||||
|
|
||||||
/* Write the sample */
|
/* Write the sample */
|
||||||
if ( !buffer.empty() ) {
|
if ( !buffer.empty() ) {
|
||||||
|
unsigned int bufSize = buffer.size();
|
||||||
if ( !MP4WriteSample(
|
if ( !MP4WriteSample(
|
||||||
mp4h,
|
mp4h,
|
||||||
mp4vtid,
|
mp4vtid,
|
||||||
buffer.extract(buffer.size()),
|
buffer.extract(bufSize),
|
||||||
buffer.size(),
|
bufSize,
|
||||||
duration,
|
duration,
|
||||||
offset,
|
offset,
|
||||||
prevKeyframe) ) {
|
prevKeyframe) ) {
|
||||||
|
|
Loading…
Reference in New Issue