Skip to content

Commit

Permalink
Fix random video freeze at resume
Browse files Browse the repository at this point in the history
Fix the previous workaround which tries to avoid 10sec subs latency.
Too short seekback creates Aud/Vid synching issues and sometimes random freeze at resume.
It needs 10sec seekback at least for proper buffering alignement.
Skip the seekback on Audio track switch for responsivness, thus accepting the latency.

Fix the previous workaround which tries to avoid 10sec subs latency.
Too short seekback creates Aud/Vid synching issues and sometimes random freeze at resume.
It needs 10sec seekback at least for proper buffering alignement.
Skip the seekback on Audio track switch for responsivness, thus accepting the latency.

v1.0.3BETA4-2

Add delay for short rewind on Resume (to avoid Large Audio sync errors and sometimes video freezes)

v1.0.3BETA4

add debug messages.

Additional log messages

... to debug Forced Short Rewind used in 1.0.2 Fix 10sec latency
  • Loading branch information
rockrider69 committed Jan 6, 2024
1 parent 8763916 commit 5e8d8bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion addon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<addon
id="service.languagepreferencemanager"
name="Language Preference Manager"
version="1.0.3BETA3"
version="1.0.3BETA4"
provider-name="ace20022/scott967/rockrider69"
>
<requires>
Expand Down Expand Up @@ -30,6 +30,7 @@
Overrides general 'Ignore Signs and Songs toggle' or 'Blacklisting Signs via keyword', if ever used.
1.0.3BETA2: Keywords Blacklist for Audio tracks. Same principle as for Subtitles, based on track name, to skip some (ex. Commentary, ...)
1.0.3BETA3: Fixed Greek language codes. Fix some typos.
1.0.3BETA4: Fix random video/audio freeze at resume due to previous "Fix 10sec latency". Rewrite it and add debug messages.

</news>
<assets>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
--- Version 1.0.3BETA4

- Fix random video/audio freeze at resume due to previous "Fix 10sec latency". Rewrite it and add debug messages.

--- Version 1.0.3BETA3

- Fixed Greek language codes. Fix some typos.
Expand Down
15 changes: 12 additions & 3 deletions resources/lib/prefutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,21 @@ def evalPrefs(self):
self.showSubtitles(True)

# Workaround to an old Kodi bug creating 10-15 sec latency when activating a subtitle track.
# Force very short rewind to avoid 10-15sec delay and first few subtitles lines potentially lost
# Force a short rewind to avoid 10-15sec delay and first few subtitles lines potentially lost
# but if we are very close to beginning, then restart from time 0
if (self.getTime() <= 10):
current_time = self.getTime()
if (current_time <= 10):
# This is a probably an initial start, seek back to 0 is securing subs are displayed immediately
log(LOG_DEBUG, 'Forced rewind - Position time is {0} sec. Too close to start, restart from 0.'.format(current_time))
self.seekTime(0)
elif (not self.LPM_initial_run_done):
# This is a resume, seek back 10sec to secure the 8sec normal Aud/Vid buffers are flushed
# Seek back less while resuming (ex. 1sec) create too many Large Audio Sync errors, with some unwanted restart from 0, or even possible bug freeze
log(LOG_DEBUG, 'Forced rewind - Position time was {0} sec. Resume with 10 sec rewind.'.format(current_time))
self.seekTime(current_time - 10)
else:
self.seekTime(self.getTime()-1)
# This is an Audio Track change on-the-fly, accept the subs latency to keep snappyness. No seek back at all.
log(LOG_DEBUG, 'No Forced rewind - Position time was {0} sec. Audio switch - Subs display slightly delayed.'.format(current_time))

def evalFilenamePrefs(self):
log(LOG_DEBUG, 'Evaluating filename preferences' )
Expand Down

0 comments on commit 5e8d8bf

Please sign in to comment.