From 69c03bdaa5b539ee16a1d65a74a0b4adf9d8b329 Mon Sep 17 00:00:00 2001 From: Et0h Date: Mon, 19 May 2014 14:49:52 +0100 Subject: [PATCH] Reduce VLC CPU use (DerGenaue's code, adapted) --- resources/lua/intf/syncplay.lua | 12 ++++++++---- syncplay/constants.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/resources/lua/intf/syncplay.lua b/resources/lua/intf/syncplay.lua index 0e526cc..96c43df 100644 --- a/resources/lua/intf/syncplay.lua +++ b/resources/lua/intf/syncplay.lua @@ -2,9 +2,10 @@ syncplay.lua: Syncplay interface module for VLC --[==========================================================================[ - Author: Etoh + Principal author: Etoh + Other contributors: DerGenaue, jb Project: http://syncplay.pl/ - Version: 0.1.9 + Version: 0.2.0 Note: * This interface module is intended to be used in conjunction with Syncplay. @@ -85,8 +86,10 @@ else require "common" end -local connectorversion = "0.1.9" -local durationdelay = 500000 -- Pause for get_duration command etc for increased reliability +local connectorversion = "0.2.0" +local durationdelay = 500000 -- Pause for get_duration command etc for increased reliability (uses microseconds) +local loopsleepduration = 5000 -- Pause for every event loop (uses microseconds) + local host = "localhost" local port @@ -526,6 +529,7 @@ while running == true do vlc.net.send( fd, responsebuffer ) responsebuffer = "" end + vlc.misc.mwait(vlc.misc.mdate() + loopsleepduration) -- Don't waste processor time end diff --git a/syncplay/constants.py b/syncplay/constants.py index bd392ad..88e7f2e 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -43,7 +43,7 @@ COMMANDS_ROOM = ["r", "room"] COMMANDS_HELP = ['help', 'h', '?', '/?', r'\?'] MPC_MIN_VER = "1.6.4" VLC_MIN_VERSION = "2.0.0" -VLC_INTERFACE_MIN_VERSION = "0.1.9" +VLC_INTERFACE_MIN_VERSION = "0.2.0" MPC_PATHS = [ r"C:\Program Files (x86)\MPC-HC\mpc-hc.exe", r"C:\Program Files\MPC-HC\mpc-hc.exe",