hedgewars/avwrapper/avwrapper.c
branchui-scaling
changeset 15288 c4fd2813b127
parent 14950 00cf807b7faa
--- a/hedgewars/avwrapper/avwrapper.c	Wed May 16 18:22:28 2018 +0200
+++ b/hedgewars/avwrapper/avwrapper.c	Wed Jul 31 23:14:27 2019 +0200
@@ -35,6 +35,8 @@
 #define AVWRAP_DECL
 #endif
 
+#define UNUSED(x) (void)(x)
+
 static AVFormatContext* g_pContainer;
 static AVOutputFormat* g_pFormat;
 static AVStream* g_pAStream;
@@ -138,6 +140,9 @@
 // (there is mutex in AddFileLogRaw).
 static void LogCallback(void* p, int Level, const char* pFmt, va_list VaArgs)
 {
+    UNUSED(p);
+    UNUSED(Level);
+
     char Buffer[1024];
 
     vsnprintf(Buffer, 1024, pFmt, VaArgs);
@@ -362,6 +367,8 @@
         VideoTime = (double)g_pVFrame->pts * g_pVStream->time_base.num/g_pVStream->time_base.den;
         do
         {
+            if (!g_pAFrame)
+                return FatalError("Error while writing video frame: g_pAFrame does not exist");
             AudioTime = (double)g_pAFrame->pts * g_pAStream->time_base.num/g_pAStream->time_base.den;
             ret = WriteAudioFrame();
         }