Re: [spice v6] server: Provide a framerate estimate based on the initial frames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, Dec 10, 2015 at 12:16:19PM +0100, Francois Gouget wrote:
> On Thu, 10 Dec 2015, Victor Toso wrote:
> [...]
> > > > +    drawable->creation_time = drawable->first_frame_time =red_get_monotonic_time();
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
> > need extra space!
>
> Yes. I fixed it locally but I'm hesitant to resubmit just for that.
> In the worst case it will be fixed with the rename to
> spice_get_monotonic_ns().

Yes, no need to resend.

>
> [...]
> > > > +    /* Provide an fps estimate the video encoder can use when initializing
> > > > +     * based on the frames that lead to the creation of the stream. Round to
> > > > +     * the nearest integer, for instance 24 for 23.976.
> > > > +     */
> > > > +    uint64_t duration = drawable->creation_time - drawable->first_frame_time;
> > > > +    if (duration > (uint64_t)drawable->frames_count * 1000 * 1000 * 1000 / MAX_FPS) {
> > > > +        stream->input_fps = ((uint64_t)drawable->frames_count * 1000 * 1000 * 1000 + duration / 2) / duration;
> >
> > Why + (duration/2) ? This would be the same as [ x/2 + 1/2 ] so I'm
> > guessing it is for the rounding, right?
>
> Yes, it's to round to the nearest integer.
> The general principle is that if your division truncates, then
> round_to_nearest( ((double)x) / n ) = (x + n/2) / n
>
> I'll also note that this is a case where we want the most accurate
> estimate of the fps so round to nearest makes sense.

Sure

>
> --
> Francois Gouget <fgouget@xxxxxxxxxxxxxxx>


If no one complains I'll be pushing this later on.
Thanks for your work,
  toso
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]