[vlc-devel] [PATCH] mux/avformat: normalize pts and dts in AVPacket

Filip Roséen filip at atch.se
Tue Feb 7 16:16:20 CET 2017


Hi Tristan,

On 2017-02-07 16:00, Tristan Matthews wrote:

> On Tue, Feb 7, 2017 at 1:15 PM, Filip Roséen <filip at atch.se> wrote:
> >
> > +static mtime_t NormalizeTS( mtime_t *base, AVStream* p_stream, mtime_t
> > timestamp )
> > +{
> > +    if( *base == VLC_TS_INVALID )
> > +        *base = timestamp;
> > +
> > +    return ( timestamp - *base ) * p_stream->time_base.den /
> > +           CLOCK_FREQ / p_stream->time_base.num;
> >
> 
> If you can avoid integer overflow, you may want to do a multiplication
> instead of a second division here:
> ( timestamp - *base ) * p_stream->time_base.den / (CLOCK_FREQ *
> p_stream->time_base.num);

I simply used the same expression as was present in the
*translation-unit* prior to the proposed changes.

If the solution presented (as a whole) is accepted into the codebase I
will keep your suggestion in mind, and polish it further!
 
> Disclaimer: have not tested or profiled this (hence the "may").

Thank you,\
Filip Roséen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170207/39ae93d4/attachment.html>


More information about the vlc-devel mailing list