From: Rudolf Polzer Date: Sun, 5 Jun 2011 19:38:02 +0000 (+0200) Subject: fix pts calculation for audio X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8b4204ac1b4cf026ba003bbcfe6efdf1b1fd8208;p=xonotic%2Fdarkplaces.git fix pts calculation for audio --- 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");