videorec: Always initialize audio and video time bases 0.9.22
authorVittorio Giovara <vittorio.giovara@gmail.com>
Tue, 10 Nov 2015 13:53:14 +0100
branch0.9.22
changeset 11596 ba7e67586fcd
parent 11595 9a17a39eccdc
child 11597 4575b6990348
videorec: Always initialize audio and video time bases In both context and stream.
hedgewars/avwrapper/avwrapper.c
--- a/hedgewars/avwrapper/avwrapper.c	Tue Nov 10 13:53:13 2015 +0100
+++ b/hedgewars/avwrapper/avwrapper.c	Tue Nov 10 13:53:14 2015 +0100
@@ -149,6 +149,10 @@
     g_pAudio->sample_rate = g_Frequency;
     g_pAudio->channels = g_Channels;
 
+    // set time base as invers of sample rate
+    g_pAudio->time_base.den = g_pAStream->time_base.den = g_Frequency;
+    g_pAudio->time_base.num = g_pAStream->time_base.num = 1;
+
     // set quality
     g_pAudio->bit_rate = 160000;
 
@@ -254,8 +258,8 @@
        of which frame timestamps are represented. for fixed-fps content,
        timebase should be 1/framerate and timestamp increments should be
        identically 1. */
-    g_pVideo->time_base.den = g_Framerate.num;
-    g_pVideo->time_base.num = g_Framerate.den;
+    g_pVideo->time_base.den = g_pVStream->time_base.den = g_Framerate.num;
+    g_pVideo->time_base.num = g_pVStream->time_base.num = g_Framerate.den;
     //g_pVideo->gop_size = 12; /* emit one intra frame every twelve frames at most */
     g_pVideo->pix_fmt = AV_PIX_FMT_YUV420P;