diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m index 35f3629cb61..73e23ea8abd 100644 --- a/source/blender/quicktime/apple/qtkit_export.m +++ b/source/blender/quicktime/apple/qtkit_export.m @@ -587,6 +587,7 @@ int append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int rect NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSBitmapImageRep *blBitmapFormatImage; NSImage *frameImage; + OSStatus err = noErr; unsigned char *from_Ptr,*to_Ptr; 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) { UInt32 audioPacketsConverted; /* Append audio */ - while (((double)qtexport->audioTotalExportedFrames / (double) qtexport->audioInputFormat.mSampleRate) - < ((double)(frame - rd->sfra)) / (((double)rd->frs_sec) / rd->frs_sec_base)) { + while (qtexport->audioTotalExportedFrames < qtexport->audioLastFrame) { qtexport->audioBufferList.mNumberBuffers = 1; 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; audioPacketsConverted = AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize; - AudioConverterFillComplexBuffer(qtexport->audioConverter, AudioConverterInputCallback, + err = AudioConverterFillComplexBuffer(qtexport->audioConverter, AudioConverterInputCallback, NULL, &audioPacketsConverted, &qtexport->audioBufferList, qtexport->audioOutputPktDesc); if (audioPacketsConverted) { 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];