[Spice-devel] [PATCH spice-gtk v3 2/6] playback: Use the audio timestamps for the global mmtime conversion
Frediano Ziglio
fziglio at redhat.com
Fri Jul 26 09:52:09 UTC 2019
From: Francois Gouget <fgouget at codeweavers.com>
More data helps improve the accuracy of the estimation of the true clock
offset and minimum network latency.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
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
More information about the Spice-devel
mailing list