[Spice-commits] src/channel-display.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jan 3 11:14:31 UTC 2019
src/channel-display.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit d047b2fb7f5d492d6c49f589ba5ff862c6b115da
Author: Snir Sheriber <ssheribe at redhat.com>
Date: Mon Dec 31 11:41:07 2018 +0200
channel-display: set 0 latency if there is no playback
If playback is not active and it's streaming mode set latency to 0
so frames will not be synchronized with mm time.
Signed-off-by: Snir Sheriber <ssheribe at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/src/channel-display.c b/src/channel-display.c
index e5e5f56..fbcaf72 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1526,7 +1526,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
SpiceStreamDataHeader *op = spice_msg_in_parsed(in);
display_stream *st = get_stream_by_id(channel, op->id);
guint32 mmtime;
- int32_t latency;
+ int32_t latency, latency_report;
SpiceFrame *frame;
g_return_if_fail(st != NULL);
@@ -1546,7 +1546,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
}
st->num_input_frames++;
- latency = op->multi_media_time - mmtime;
+ latency = latency_report = op->multi_media_time - mmtime;
if (latency < 0) {
CHANNEL_DEBUG(channel, "stream data too late by %u ms (ts: %u, mmtime: %u)",
mmtime - op->multi_media_time, op->multi_media_time, mmtime);
@@ -1562,7 +1562,15 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
st->cur_drops_seq_stats.len++;
st->playback_sync_drops_seq_len++;
} else {
- CHANNEL_DEBUG(channel, "video latency: %d", latency);
+ SpiceSession *s = spice_channel_get_session(channel);
+
+ if (st->surface->streaming_mode && !spice_session_is_playback_active(s)) {
+ CHANNEL_DEBUG(channel, "video latency: %d, set to 0 since there is no playback", latency);
+ latency = 0;
+ } else {
+ CHANNEL_DEBUG(channel, "video latency: %d", latency);
+ }
+
if (st->cur_drops_seq_stats.len) {
st->cur_drops_seq_stats.duration = op->multi_media_time -
st->cur_drops_seq_stats.start_mm_time;
@@ -1593,7 +1601,7 @@ static void display_handle_stream_data(SpiceChannel *channel, SpiceMsgIn *in)
if (c->enable_adaptive_streaming) {
display_update_stream_report(SPICE_DISPLAY_CHANNEL(channel), op->id,
- op->multi_media_time, latency);
+ op->multi_media_time, latency_report);
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;
More information about the Spice-commits
mailing list