Skip to content

Commit ad30afc

Browse files
committed
Fixing race condition on Export dialog, which would invoke timeline.ApplyMapperToClips() after the export had begun... usually introducing a glitch into the 1st 10 frames written to the video file (when exporting to a different framerate)
1 parent 035fdb1 commit ad30afc

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/windows/export.py

+1-25
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,6 @@ def __init__(self, *args, **kwargs):
9494
self.close_button.setVisible(False)
9595
self.exporting = False
9696

97-
# Update FPS / Profile timer
98-
# Timer to use a delay before applying new profile/fps data (so we don't spam libopenshot)
99-
self.delayed_fps_timer = None
100-
self.delayed_fps_timer = QTimer()
101-
self.delayed_fps_timer.setInterval(200)
102-
self.delayed_fps_timer.setSingleShot(True)
103-
self.delayed_fps_timer.timeout.connect(self.delayed_fps_callback)
104-
10597
# Pause playback (to prevent crash since we are fixing to change the timeline's max size)
10698
get_app().window.actionPlay_trigger(None, force="pause")
10799

@@ -279,19 +271,6 @@ def __init__(self, *args, **kwargs):
279271
# Determine the length of the timeline (in frames)
280272
self.updateFrameRate()
281273

282-
def delayed_fps_callback(self):
283-
"""Callback for fps/profile changed event timer
284-
(to delay the timeline mapping so we don't spam libopenshot)"""
285-
# Calculate fps
286-
fps_double = self.timeline.info.fps.ToDouble()
287-
288-
# Apply mapping if valid fps detected (anything larger than 300 fps is considered invalid)
289-
if self.timeline and fps_double <= 300.0:
290-
log.info("Valid framerate detected, sending to libopenshot: %s" % fps_double)
291-
self.timeline.ApplyMapperToClips()
292-
else:
293-
log.warning("Invalid framerate detected, not sending it to libopenshot: %s" % fps_double)
294-
295274
def getProfilePath(self, profile_name):
296275
"""Get the profile path that matches the name"""
297276
for profile, path in self.profile_paths.items():
@@ -346,10 +325,6 @@ def updateFrameRate(self):
346325
self.timeline.info.channels = self.txtChannels.value()
347326
self.timeline.info.channel_layout = self.cboChannelLayout.currentData()
348327

349-
# Send changes to libopenshot (apply mappings to all framemappers)
350-
# Start or restart timer to process changes after a small delay
351-
self.delayed_fps_timer.start()
352-
353328
# Determine max frame (based on clips)
354329
self.timeline_length_int = self.timeline.GetMaxFrame()
355330

@@ -836,6 +811,7 @@ def titlestring(sec, fps, mess):
836811

837812
# Re-update the timeline FPS again (since the timeline just got clobbered)
838813
self.updateFrameRate()
814+
self.timeline.ApplyMapperToClips()
839815

840816
# Create FFmpegWriter
841817
try:

0 commit comments

Comments
 (0)