[vlc-devel] [PATCH] Subsync: added an easier way to sync subtitles

Zoran Turalija zoran.turalija at gmail.com
Wed Apr 10 10:42:32 CEST 2013

On Tue, Apr 09, 2013 at 11:43:28PM +0200, Pascal Thomet wrote:
> Answers to your feedback (many thanks for your answers :-)
> - Important : more details about Zoran's remark concerning audio stream 
> being stopped under linux in the third paragraph below
> - bookmarks are now stored in the intf_sys_t struct
> - added shortcuts for mac & linux/windows
> - See http://forum.videolan.org/viewtopic.php?f=7&t=109641 for an
> illustration of a possible use
> - I did not add a condition to check if audio track and subtitle track are
> present since it is not done by ACTIONID_SUBDELAY_UP/DOWN. I suspect that if
> I were to add this check it should be also added for these actions

After testing your latest patch, I am positive that such a check would be in
place in:

  * ACTIONID_SUBDELAY_UP........(if_sub_present)
  * ACTIONID_SUBDELAY_DOWN......(if_sub_present)
  * ACTIONID_SUBSYNC_MARKAUDIO..(if_audio_present)
  * ACTIONID_SUBSYNC_MARKSUB....(if_sub_present)
  * ACTIONID_SUBPOS_UP..........(if_sub_present)
  * ACTIONID_SUBPOS_DOWN........(if_sub_present)

Mostly, because eg. there is no subtitle loaded, one can still perform
synchronization, but question arises "of what exact subtitle?".

Same works, if there is a video file without audio, but there is subtitle.
Though, in this case maybe it kind of make sense to be able to synchronize
subtitle, because in reality, we synchronize subtitle with video & audio.

I guess this could be left for some time after this patch is accepted.

> More details about AudioStream being stopped :
> - I also reproduced the bug under a Linux virtual machine
> - I seriously suspect that a bug was introduced in the current devel branch,
> and outside of this patch
> - I can also easily reproduce it even without my patch with the following
> sequence of actions : open a video + subtitles,  select the menu
> "tools/track synchronisation", and enter "-10" into the "subtitle track
> synchro" field --> The video pauses for 10 seconds, and then the sound is
> gone…
> - This bug was not present in the release version of vlc (apt-get install
> vlc --> no problem, except for the 10 seconds delay)
> - Under OSX the same sequence of actions will not kill the sound, however it
> will emit a "buzz" sound for 10 seconds, and then the sound goes back.
> - As mentioned in the comment along with my patch, I suspect that
> var_SetTime() (and ultimately UpdatePtsDelay()) might be responsible for
> that, but I do not know the source tree well enough to be certain of my
> diagnostic.
> - I suspect that this patch might make this bug even more visible, so it
> might be advisable to postpone it until the aforementioned bug is resolved
> (but I am not the one to make this kind of decision)

You are correct. Your patch has not introduced this bug. As much as I tested
it, after commit baf47dcc4a4501b9dd1e3fea5cd1d3357dbae306, when using pulse
audio output, buffer underflow after subtitle synchronization is performed
can not recover, and that is why there is no more audio (at least on linux).

Amazing how something can trigger regression detection.

Kind regards,
Zoran Turalija

More information about the vlc-devel mailing list