GNOME Bugzilla – Bug 673502
[ges][pitivi] Deadlock if there is only audio and video in pipeline
Last modified: 2013-08-08 09:59:39 UTC
Created attachment 211289 [details] Last 100 of debug output If I add some clip to PiTiVi timeline that contains only audio or only video, PiTiVi freezes. If I add both audio and video content then everything works fine. Steps to reproduce(PiTiVi with GES and GStreamer 0.10): 1. Create new project. 2. Add some image to timeline. 3. Press "Play" button under preview widget. I've added last 100 lines of debug output as an attachment.
It seems to work here. Are you using latest version of gstreamer 0.10 plugins and pitivi?
It happens on the pitivi GES branch on git.gnome.org
Just found out the root cause for this. Pitivi creates a GesTrack for both audio and video and adds them to a GesTimeline. Each track create a GnlComposition inside, and this composition has a background object, that is used to fill gaps when there is no media for that time. For a timeline to unblock and start 'working', it needs its internal tracks to signal no-more-pads, and that only happens when the compositions expose their pads. The problem is that a GnlComposition won't use this 'background' object unless there is a gap to be filled, and no media means no gap. If you add a video/audio-only media to the timeline, it will make one of the compositions expose its pad, but the other won't expose because it will consider it has no media. This way, the whole timeline hangs waiting for a pad what will never be exposed. One solution is to make Pitivi only add tracks if they are really needed, not sure how easy it is as I never touched Pitivi code. The other is to make GES' compositions expose the background as a last resort if there are no other medias available, they should expose it for the duration of the timeline. I'd prefer the first, if possible, as you don't end up with an unnecessary Track in your exported file, which is specially odd if you're working with an audio-only clip and the resulting file has a black screen video track as a side effect.
There are 2 other problems associated with the issue described above that prevent this from working. 2) In pitivi/utils/timeline.py, the following exception is thrown: Traceback (most recent call last):
+ Trace 230090
self._move_temp_source(self.hadj.props.value + x, y)
self._move_context.editTo(delta, priority)
position, priority = self._defaultTo(position, priority)
position + self.default_span)
tckobj.get_timeline_object().get_layer(), start)
tckobjs = focus.get_track().get_objects() AttributeError: 'NoneType' object has no attribute 'get_objects
This prevents the gnlcomposition's update property from being set to True later in this codepath. The same problem occurs in next_track_source function as well. 3) In gnlcomposition.c, get_clean_toplevel_stack it searches for an element using: if ((object->start > *timestamp) && object->active), and the start and timestamp are equals, so our gnlurisource is never picked up to be exposed in the source pad. Changing the > for >= makes it work. All those are still hacks, but now we know the problems we need to solve.
Not sure about something you said in comment 3: > One solution is to make Pitivi only add tracks if they are really needed I don't see how that can be possible... the point of the feature where you can choose to render audio only or video only is that the user does not care about what is in the timeline; for example he inserted clips that have both audio and video, but only wants to render the video. The user won't be manually removing the audio parts of the timeline, the audio "track" will still be there... Maybe I'm misunderstanding something? Anyway, I appreciate you looking into this issue :)
Created attachment 212627 [details] [review] utils/timeline: Prevent exception when object wasn't added to track Check if the object is added to a track before attemping to access it. This patch fixes the bug number 2 on this list. I need someone with pitivi experience to review it. I think the real fault is that the object should have already been added to a track before this code is reached, but I'm new to pitivi at the moment.
Created attachment 212822 [details] [review] gnlcomposition: Update pipeline always if there is no active object The composition could be waiting for this object to expose its pads if there are no other active objects. If we don't update the pipeline, it could wait hanging Not sure if this patch is the ideal option, what happens is that the whole pipeline freezes because the gnlcomposition doesn't expose its pads as there is the gnlobject inside it wasn't discovered before the composition looped over its elements looking for the current element to expose. This patch makes the composition always check if it should update the pipeline when an internal object has its start/stop times updated.
I just tested that again and it now works properly, setting it as FIXED.
Indeed, I've seen audio-only rendering work a few days ago. Miracles n' stuff.