Move SDL_GetTicks() to another place, maybe this will fix sound desync.
Also, ensure that thumbnail is aslways saved.
--- a/hedgewars/uVideoRec.pas Sun Jul 08 13:18:52 2012 +0400
+++ b/hedgewars/uVideoRec.pas Sun Jul 08 13:21:12 2012 +0400
@@ -248,12 +248,9 @@
AddFileLog('BeginPreRecording');
numFrames:= 0;
- startTime:= SDL_GetTicks();
-
+ thumbnailSaved:= false;
RecPrefix:= FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now());
- thumbnailSaved:= false;
-
Mix_QuerySpec(@frequency, @format, @channels);
AddFileLog('sound: frequency = ' + IntToStr(frequency) + ', format = ' + IntToStr(format) + ', channels = ' + IntToStr(channels));
if format <> $8010 then
@@ -284,6 +281,7 @@
exit;
end;
+ // save audio parameters in sound file
BlockWrite(audioFile, frequency, 4);
BlockWrite(audioFile, channels, 4);
{$IOCHECKS ON}
@@ -291,6 +289,7 @@
// register callback for actual audio recording
Mix_SetPostMix(@RecordPostMix, nil);
+ startTime:= SDL_GetTicks();
flagPrerecording:= true;
end;
@@ -305,6 +304,9 @@
Close(cameraFile);
Mix_SetPostMix(nil, nil);
SDL_UnlockAudio();
+
+ if not thumbnailSaved then
+ SaveThumbnail();
end;
procedure SaveCameraPosition;