gst-libs/gst/audio/gstbaseaudiosrc.c: Avoid nasty int overflows after about 12 hours and 25 minutes when these code p...

Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_offset), (gst_base_audio_src_create):
Avoid nasty int overflows after about 12 hours and 25 minutes when these
code paths are triggered.
A free beer to Håvard Graff for finding this!
This commit is contained in:
Wim Taymans 2008-11-27 16:47:41 +00:00
parent d80a5c9dbc
commit af354dbef3
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2008-11-27 Wim Taymans <wim.taymans@collabora.co.uk>
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_offset), (gst_base_audio_src_create):
Avoid nasty int overflows after about 12 hours and 25 minutes when these
code paths are triggered.
A free beer to Håvard Graff for finding this!
2008-11-27 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: 이문형 <iwings at gmail dot com>

View file

@ -718,7 +718,7 @@ gst_base_audio_src_get_offset (GstBaseAudioSrc * src)
if (diff >= segtotal) {
GST_DEBUG_OBJECT (src, "dropped, align to segment %d", segdone);
/* sample would be dropped, position to next playable position */
sample = (segdone - segtotal + 1) * sps;
sample = ((guint64) (segdone - segtotal + 1)) * sps;
}
return sample;
@ -922,7 +922,7 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
ringbuffer->segbase -= segment_diff;
/* we calculate the new sample value */
new_sample = new_first_segment * sps;
new_sample = ((guint64) new_first_segment) * sps;
/* and get the relative time to this -> our new timestamp */
timestamp =