[FFmpeg-cvslog] alsa-audio-dec: explicitly cast the delay to a signed int64

Anton Khirnov git at videolan.org
Sun Jan 12 16:44:05 CET 2014


ffmpeg | branch: release/1.1 | Anton Khirnov <anton at khirnov.net> | Sun Dec  1 09:27:01 2013 +0100| [f9f2591beb1125237be803f1f9b6c576f5ae60a7] | committer: Reinhard Tartler

alsa-audio-dec: explicitly cast the delay to a signed int64

Otherwise the expression will be evaluated as unsigned, which will break
when the result should be negative.
CC:libav-stable at libav.org

(cherry picked from commit 089fac77a6bf9199a5ec161e9c27850f0a680541)
Signed-off-by: Reinhard Tartler <siretart at tauware.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f9f2591beb1125237be803f1f9b6c576f5ae60a7
---

 libavdevice/alsa-audio-dec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index 5b32ed9..0687a4a 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -142,7 +142,7 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
     ts_delay += res;
     pkt->pts = timestamp.tv_sec * 1000000LL
                + (timestamp.tv_nsec * st->codec->sample_rate
-                  - ts_delay * 1000000000LL + st->codec->sample_rate * 500LL)
+                  - (int64_t)ts_delay * 1000000000LL + st->codec->sample_rate * 500LL)
                / (st->codec->sample_rate * 1000LL);
 
     pkt->size = res * s->frame_size;



More information about the ffmpeg-cvslog mailing list