From 8b4204ac1b4cf026ba003bbcfe6efdf1b1fd8208 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 5 Jun 2011 21:38:02 +0200 Subject: [PATCH] fix pts calculation for audio --- cap_lavc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cap_lavc.c b/cap_lavc.c index edbd2405..f5e27fd6 100644 --- a/cap_lavc.c +++ b/cap_lavc.c @@ -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"); -- 2.39.2