Fix for [#23912]: Replace by integer comparison a float comparison whose precision errors was causing an infinite loop during last frame audio conversion

This commit is contained in:
Damien Plisson 2010-09-26 16:11:53 +00:00
parent 47628dfab6
commit cf6b2ca034

@ -587,6 +587,7 @@ int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int rect
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSBitmapImageRep *blBitmapFormatImage; NSBitmapImageRep *blBitmapFormatImage;
NSImage *frameImage; NSImage *frameImage;
OSStatus err = noErr;
unsigned char *from_Ptr,*to_Ptr; unsigned char *from_Ptr,*to_Ptr;
int y,from_i,to_i; int y,from_i,to_i;
@ -628,8 +629,7 @@ int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int rect
if (qtexport->audioFile) { if (qtexport->audioFile) {
UInt32 audioPacketsConverted; UInt32 audioPacketsConverted;
/* Append audio */ /* Append audio */
while (((double)qtexport->audioTotalExportedFrames / (double) qtexport->audioInputFormat.mSampleRate) while (qtexport->audioTotalExportedFrames < qtexport->audioLastFrame) {
< ((double)(frame - rd->sfra)) / (((double)rd->frs_sec) / rd->frs_sec_base)) {
qtexport->audioBufferList.mNumberBuffers = 1; qtexport->audioBufferList.mNumberBuffers = 1;
qtexport->audioBufferList.mBuffers[0].mNumberChannels = qtexport->audioOutputFormat.mChannelsPerFrame; qtexport->audioBufferList.mBuffers[0].mNumberChannels = qtexport->audioOutputFormat.mChannelsPerFrame;
@ -637,7 +637,7 @@ int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int rect
qtexport->audioBufferList.mBuffers[0].mData = qtexport->audioOutputBuffer; qtexport->audioBufferList.mBuffers[0].mData = qtexport->audioOutputBuffer;
audioPacketsConverted = AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize; audioPacketsConverted = AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize;
AudioConverterFillComplexBuffer(qtexport->audioConverter, AudioConverterInputCallback, err = AudioConverterFillComplexBuffer(qtexport->audioConverter, AudioConverterInputCallback,
NULL, &audioPacketsConverted, &qtexport->audioBufferList, qtexport->audioOutputPktDesc); NULL, &audioPacketsConverted, &qtexport->audioBufferList, qtexport->audioOutputPktDesc);
if (audioPacketsConverted) { if (audioPacketsConverted) {
AudioFileWritePackets(qtexport->audioFile, false, qtexport->audioBufferList.mBuffers[0].mDataByteSize, AudioFileWritePackets(qtexport->audioFile, false, qtexport->audioBufferList.mBuffers[0].mDataByteSize,
@ -656,6 +656,12 @@ int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int rect
} }
else {
//Error getting audio packets
BKE_reportf(reports, RPT_ERROR, "Unable to get further audio packets from frame %i, error = 0x%x",qtexport->audioTotalExportedFrames,err);
break;
}
} }
} }
[pool drain]; [pool drain];