[Live-devel] Indexing of TS files for non MPEG2 video streams

Ross Finlayson finlayson at live555.com
Wed Oct 27 05:36:58 PDT 2010


>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.
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list