[Spice-devel] server: Reuse red_get_monotonic_time() in the MJPEG video encoder
Frediano Ziglio
fziglio at redhat.com
Thu Dec 3 07:54:41 PST 2015
> On Thu, 2015-12-03 at 16:28 +0100, Francois Gouget wrote:
> > Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> > ---
> > server/mjpeg_encoder.c | 5 +----
> > 1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/server/mjpeg_encoder.c b/server/mjpeg_encoder.c
> > index 752dae8..60060fc 100644
> > --- a/server/mjpeg_encoder.c
> > +++ b/server/mjpeg_encoder.c
> > @@ -1345,16 +1345,13 @@ MJpegEncoder *mjpeg_encoder_new(uint64_t
> > starting_bit_rate,
> > encoder->starting_bit_rate = starting_bit_rate;
> >
> > if (cbs) {
> > - struct timespec time;
> > -
> > - clock_gettime(CLOCK_MONOTONIC, &time);
> > encoder->cbs = *cbs;
> > encoder->cbs_opaque = cbs_opaque;
> > mjpeg_encoder_reset_quality(encoder, MJPEG_QUALITY_SAMPLE_NUM / 2,
> > 5,
> > 0);
> > encoder->rate_control.during_quality_eval = TRUE;
> > encoder->rate_control.quality_eval_data.type =
> > MJPEG_QUALITY_EVAL_TYPE_SET;
> > encoder->rate_control.quality_eval_data.reason =
> > MJPEG_QUALITY_EVAL_REASON_RATE_CHANGE;
> > - encoder->rate_control.warmup_start_time = ((uint64_t) time.tv_sec)
> > *
> > 1000000000 + time.tv_nsec;
> > + encoder->rate_control.warmup_start_time =
> > red_get_monotonic_time();
> > } else {
> > encoder->cbs.get_roundtrip_ms = NULL;
> > mjpeg_encoder_reset_quality(encoder,
> > MJPEG_LEGACY_STATIC_QUALITY_ID,
> > MJPEG_MAX_FPS, 0);
>
> Looks good.
>
> Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
Yes, I already merged it.
Note that is moved the time reading after mjpeg_encoder_reset_quality
(which is small anyway) but I think is even better.
Frediano
More information about the Spice-devel
mailing list