]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix pts calculation for audio
authorRudolf Polzer <divverent@xonotic.org>
Sun, 5 Jun 2011 19:38:02 +0000 (21:38 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 5 Jun 2011 19:38:02 +0000 (21:38 +0200)
cap_lavc.c

index edbd24053cb6054ef663006f5a8796c55e0b4d2d..f5e27fd6ea6773c00b030520ae4ba022ca9c832a 100644 (file)
@@ -985,7 +985,7 @@ static void SCR_CaptureVideo_Lavc_SoundFrame_Encode(void)
                size = qavcodec_encode_audio(avc, format->buffer, format->bufsize, format->aframe);
 
        if(format->asavepts == ANNOYING_CAST_FOR_MRU(AV_NOPTS_VALUE))
-               format->asavepts = format->apts;
+               format->asavepts = floor(format->apts / (double) cls.capturevideo.soundrate * (double) format->avf->streams[1]->time_base.den / (double) format->avf->streams[1]->time_base.num + 0.5);
 
        if(size < 0)
                Con_Printf("error encoding\n");
@@ -1018,7 +1018,7 @@ static void SCR_CaptureVideo_Lavc_SoundFrame_EncodeEnd(void)
                size = qavcodec_encode_audio(avc, format->buffer, format->bufsize, NULL);
 
                if(format->asavepts == ANNOYING_CAST_FOR_MRU(AV_NOPTS_VALUE))
-                       format->asavepts = format->apts;
+                       format->asavepts = floor(format->apts / (double) cls.capturevideo.soundrate * (double) format->avf->streams[1]->time_base.den / (double) format->avf->streams[1]->time_base.num + 0.5);
 
                if(size < 0)
                        Con_Printf("error encoding\n");