More data helps improve the accuracy of the estimation of the true clock offset and minimum network latency. Signed-off-by: Francois Gouget <fgouget@xxxxxxxxxxxxxxx> --- src/channel-playback.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/channel-playback.c b/src/channel-playback.c index a00706fe..656a4037 100644 --- a/src/channel-playback.c +++ b/src/channel-playback.c @@ -302,14 +302,16 @@ static void playback_handle_data(SpiceChannel *channel, SpiceMsgIn *in) { SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv; SpiceMsgPlaybackPacket *packet = spice_msg_in_parsed(in); + SpiceSession *session; #ifdef DEBUG CHANNEL_DEBUG(channel, "%s: time %u data %p size %d", __FUNCTION__, packet->time, packet->data, packet->data_size); #endif - if (spice_mmtime_diff(c->last_time, packet->time) > 0) - g_warn_if_reached(); + /* This also updates the time offset */ + session = spice_channel_get_session(channel); + spice_session_mmtime2client_time(session, packet->time); c->last_time = packet->time; @@ -361,11 +363,16 @@ static void playback_handle_start(SpiceChannel *channel, SpiceMsgIn *in) { SpicePlaybackChannelPrivate *c = SPICE_PLAYBACK_CHANNEL(channel)->priv; SpiceMsgPlaybackStart *start = spice_msg_in_parsed(in); + SpiceSession *session; CHANNEL_DEBUG(channel, "%s: fmt %u channels %u freq %u time %u mode %s", __FUNCTION__, start->format, start->channels, start->frequency, start->time, spice_audio_data_mode_to_string(c->mode)); + /* This also updates the time offset */ + session = spice_channel_get_session(channel); + spice_session_mmtime2client_time(session, start->time); + c->frame_count = 0; c->last_time = start->time; c->is_active = TRUE; -- 2.20.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel