diff options
author | Yonit Halperin <yhalperi@redhat.com> | 2013-02-19 12:07:14 -0500 |
---|---|---|
committer | Yonit Halperin <yhalperi@redhat.com> | 2013-04-22 11:42:39 -0400 |
commit | 42b9f1aa911ce81ca70c000125dcbaa325470403 (patch) | |
tree | 4ebe7e1dd95ed5988ef2f816748586c35657ed8e | |
parent | 9ad3b82a5e0da1bb4069b15181db5fc2d298b3d1 (diff) |
channel-display: trigger re-sync of audio playback latency when there are frequent video frame drops
This was added in order to respond more quickly when the audio and video playback are
not synchronized, and when the latency between the client and the server
is high (i.e., when the server response to the status is delayed).
-rw-r--r-- | gtk/channel-display-priv.h | 2 | ||||
-rw-r--r-- | gtk/channel-display.c | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gtk/channel-display-priv.h b/gtk/channel-display-priv.h index 49f82fe..09683be 100644 --- a/gtk/channel-display-priv.h +++ b/gtk/channel-display-priv.h @@ -88,6 +88,8 @@ typedef struct display_stream { GArray *drops_seqs_stats_arr; uint32_t num_drops_seqs; + uint32_t playback_sync_drops_seq_len; + /* playback quality report to server */ gboolean report_is_active; uint32_t report_id; diff --git a/gtk/channel-display.c b/gtk/channel-display.c index ca77653..9e03727 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -1303,6 +1303,7 @@ static void display_update_stream_report(SpiceDisplayChannel *channel, uint32_t } } +#define STREAM_PLAYBACK_SYNC_DROP_SEQ_LEN_LIMIT 5 /* coroutine context */ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in) { @@ -1339,11 +1340,14 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in) mmtime - op->multi_media_time, op->multi_media_time, mmtime); st->arrive_late_time += mmtime - op->multi_media_time; st->num_drops_on_arive++; + if (!st->cur_drops_seq_stats.len) { st->cur_drops_seq_stats.start_mm_time = op->multi_media_time; } st->cur_drops_seq_stats.len++; + st->playback_sync_drops_seq_len++; } else { + CHANNEL_DEBUG(channel, "video latency: %d", latency); spice_msg_in_ref(in); g_queue_push_tail(st->msgq, in); display_stream_schedule(st); @@ -1354,9 +1358,14 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in) memset(&st->cur_drops_seq_stats, 0, sizeof(st->cur_drops_seq_stats)); st->num_drops_seqs++; } + st->playback_sync_drops_seq_len = 0; } display_update_stream_report(SPICE_DISPLAY_CHANNEL(channel), op->id, op->multi_media_time, latency); + if (st->playback_sync_drops_seq_len >= STREAM_PLAYBACK_SYNC_DROP_SEQ_LEN_LIMIT) { + spice_session_sync_playback_latency(spice_channel_get_session(channel)); + st->playback_sync_drops_seq_len = 0; + } } /* coroutine context */ |