After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 673502 - [ges][pitivi] Deadlock if there is only audio and video in pipeline
[ges][pitivi] Deadlock if there is only audio and video in pipeline
Status: VERIFIED FIXED
Product: GStreamer
Classification: Platform
Component: gst-editing-services
0.10.x
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 674841
Blocks:
 
 
Reported: 2012-04-04 12:47 UTC by vladimir.rudoy
Modified: 2013-08-08 09:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Last 100 of debug output (20.90 KB, text/x-log)
2012-04-04 12:47 UTC, vladimir.rudoy
  Details
utils/timeline: Prevent exception when object wasn't added to track (1.15 KB, patch)
2012-04-23 17:50 UTC, Thiago Sousa Santos
none Details | Review
gnlcomposition: Update pipeline always if there is no active object (1.37 KB, patch)
2012-04-25 17:52 UTC, Thiago Sousa Santos
none Details | Review

Description vladimir.rudoy 2012-04-04 12:47:25 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.
Comment 1 Thiago Sousa Santos 2012-04-05 14:28:52 UTC
It seems to work here. Are you using latest version of gstreamer 0.10 plugins and pitivi?
Comment 2 Thibault Saunier 2012-04-05 15:08:31 UTC
It happens on the pitivi GES branch on git.gnome.org
Comment 3 Thiago Sousa Santos 2012-04-18 17:11:51 UTC
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.
Comment 4 Thiago Sousa Santos 2012-04-19 04:12:17 UTC
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):
  • File "/home/thiagoss/devel/pitivi/pitivi/timeline/timeline.py", line 996 in _trackObjectsCreatedCb
    self._move_temp_source(self.hadj.props.value + x, y)
  • File "/home/thiagoss/devel/pitivi/pitivi/timeline/timeline.py", line 1011 in _move_temp_source
    self._move_context.editTo(delta, priority)
  • File "/home/thiagoss/devel/pitivi/pitivi/utils/timeline.py", line 473 in editTo
    position, priority = self._defaultTo(position, priority)
  • File "/home/thiagoss/devel/pitivi/pitivi/utils/timeline.py", line 708 in _defaultTo
    position + self.default_span)
  • File "/home/thiagoss/devel/pitivi/pitivi/utils/timeline.py", line 668 in snapToEdge
    tckobj.get_timeline_object().get_layer(), start)
  • File "/home/thiagoss/devel/pitivi/pitivi/utils/timeline.py", line 59 in previous_track_source
    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.
Comment 5 Jean-François Fortin Tam 2012-04-19 04:39:27 UTC
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 :)
Comment 6 Thiago Sousa Santos 2012-04-23 17:50:22 UTC
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.
Comment 7 Thiago Sousa Santos 2012-04-25 17:52:29 UTC
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.
Comment 8 Thibault Saunier 2013-08-07 13:58:28 UTC
I just tested that again and it now works properly, setting it as FIXED.
Comment 9 Jean-François Fortin Tam 2013-08-08 09:59:39 UTC
Indeed, I've seen audio-only rendering work a few days ago. Miracles n' stuff.