Pipeline freezes only on OS X
Nikos Chantziaras
realnc at gmail.com
Thu Mar 12 03:42:47 PDT 2015
On 12/03/15 12:10, Sebastian Dröge wrote:
> On Do, 2015-03-12 at 11:59 +0200, Nikos Chantziaras wrote:
>> On 12/03/15 11:37, Sebastian Dröge wrote:
>>> On Do, 2015-03-12 at 05:16 +0200, Nikos Chantziaras wrote:
>>>> Hello.
>>>>
>>>> I have a problem where video is played normally under Linux and Windows,
>>>> but in OS X (10.9.5) the pipeline just freezes.
>>>
>>> Can you get a backtrace of all threads when it freezes? This might be a
>>> bug that is already fixed in newer versions (by a patch to GLib we ship
>>> in cerbero).
>>
>> Can you point me to the patch in question? I can then build manually
>> with the patch applied and see if it fixes it. If not, then I can
>> investigate backtraces.
>
> http://cgit.freedesktop.org/gstreamer/cerbero/tree/recipes/glib/0015-Implementation-of-Cocoa-event-loop-integration-in-GM.patch?id=3621637171eb720853d83b5131bac7044ce6836e
>
> You also need to run either a GLib mainloop on your main thread, or run
> a NSRunLoop there. Otherwise things won't work properly on OSX as many
> OSX APIs require a NSRunLoop on the main thread.
I applied the patch. It works... kind of. I'm actually using Qt (5.4.1),
so there's already an NSRunLoop running. However, when starting
playback, the event loop is obviously blocked until my function returns
back to the event loop. In that function, I do:
void Player::playLooped()
{
gst_element_set_state(d->fPipeline, GST_STATE_PLAYING);
gst_element_get_state(d->fPipeline, 0, 0, GST_CLOCK_TIME_NONE);
gst_element_seek(d->fPipeline, 1.0, GST_FORMAT_TIME,
(GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT),
GST_SEEK_TYPE_END, 0, GST_SEEK_TYPE_NONE,
GST_CLOCK_TIME_NONE);
}
Before doing the segment seek (for seamless looping), I need to wait for
the state change to complete with gst_element_get_state(). But that
doesn't work. It blocks there forever.
Since you mentioned NSRunLoop, I figured that maybe I need to manually
advance the Qt event loop (which in turns advances the NSRunLoop:
gst_element_set_state(d->fPipeline, GST_STATE_PLAYING);
QApplication::processEvents(QEventLoop::AllEvents);
gst_element_get_state(d->fPipeline, 0, 0, GST_CLOCK_TIME_NONE);
But nope, still freezes. Then I tried:
gst_element_set_state(d->fPipeline, GST_STATE_PLAYING);
for (int i = 0; i < 10000; ++i) {
QApplication::processEvents(QEventLoop::AllEvents);
}
gst_element_get_state(d->fPipeline, 0, 0, GST_CLOCK_TIME_NONE);
That works fine. But this is obviously not a solution.
Tricky problem :-/
More information about the gstreamer-devel
mailing list