[Live-devel] Indexing of TS files for non MPEG2 video streams
Sébastien RAILLARD (COEXSI)
sr at coexsi.fr
Wed Oct 27 06:50:11 PDT 2010
> -----Original Message-----
> From: live-devel-bounces at ns.live555.com [mailto:live-devel-
> bounces at ns.live555.com] On Behalf Of Ross Finlayson
> Sent: mercredi 27 octobre 2010 14:37
> To: LIVE555 Streaming Media - development & use
> Subject: Re: [Live-devel] Indexing of TS files for non MPEG2 video
> streams
>
> >I think there are 2 smalls bugs involving integer overflow in the
> >LiveMedia
> >library:
> >
> >* In "MPEG2IndexFromTransportStream.cpp":
> > u_int8_t pcr_frac = (u_int8_t)(256*(pcr-pcr_int)); must be
> >replaced by:
> > u_int8_t pcr_frac = (u_int8_t)(255*(pcr-pcr_int));
> >
> >* In "MPEG2TransportStreamIndexFile.cpp":
> > return pcr_int + pcr_frac/256.0f;
> >must be replaced by:
> > return pcr_int + pcr_frac/255.0f;
>
> No - the original code is correct in both cases. Note that "pcr_frac"
> (in each case) is an 8-bit integer that represents a multiple of 1/256.
> Therefore, when converting from (or to) a float, we need to multiply (or
> divide) by 256.
Ok, I understand, it's because of the truncation when casting to integer: if
the fractional part is 0.9999999, 0. 9999999*256=255.9999744 and it's
truncated to 255 by cast, so there isn't any overflow. And as the fractional
part cannot be equal to 1, the cast values are always equal or less than
255.
Thank you.
> --
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1152 / Virus Database: 424/3221 - Release Date: 10/26/10
More information about the live-devel
mailing list