<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/6/25 Илья Кулаков <span dir="ltr"><<a href="mailto:kulakov.ilya@gmail.com" target="_blank">kulakov.ilya@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Hi,<br>
<br>
I'm trying to reuse pipeline which ends which is essentially "filesrc ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! osxvideosink<br>
<br>
The code can be reduced to:<br>
<br>
1. Init and add elements. register "pad-added" signal on qtdemux<br>
2. Set location of filesrc<br>
3. Set state of the pipeline to PLAYING<br>
4. Wait for EOS using gst_bus_timed_pop_filtered<br>
5. Set state of the pipeline to READY<br>
6. Set new location of filesrc<br>
7. Set state of the pipeline to PLAYING<br>
<br>
Unfortunately the deadlock occurs at step 7. Sometimes, when I run it through debugger it is able to create new window but that's all because it is stuck in deadlock again.<br>
Stack shown that thread is stuck in waiting for completion of the command which is deferred to another, specifically created thread for Cocoa.<br>
<br>
Since I'm primarily Mac OS X / Cocoa developer I decided to look into implementation.<br>
<br>
First of all what is the particular reason to set up new thread and run loop for each instance of osxvideosink?<br></blockquote><div style>Hi,</div><div style><br></div><div style>The sink will only create its own window if the application does not pass a window handle through the GstVideoOverlay interface and when this window is created, a run loop needs to be running to defer any Cocoa call to Cocoa's main thread. When there isn't any run loop running, like for instance when you run gst-launch, the sink needs to create a new thread and start a run loop for Cocoa (there is some black magic to make it believe that this new thread is the main thread). So this new thread with the run loop is only started when the sink needs to create its own window and the application didn't start any run loop.</div>

<div style>This hack we made to make osxvideosink work with gst-launch, but in a normal scenario, the application should have started a run loop and this internal thread will not be created.</div><div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Then it looks like thread/run loop can be started multiple times for the same instance each time you go ready -> playing.<br></blockquote><div style>This shouldn't happen at all and if it does it's a bug in the sink. In case the run loop was started in the first transition, it won't be started again since it's already running. You should check that <span style="color:rgb(0,0,0);font-size:13px">gst_osx_video_sink_run_cocoa_loop is only called once.</span></div>

<div style> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Also why is window created (destroyed) when we go from ready -> playing (and vice versa). I think it would be wise and better to reuse it unless state is transitioned to NULL.<br></blockquote><div style>This must be done this way  because the application can pass a window handle through the GstVideoOverlay in the next transition from  READY to PAUSE, and in that case the sink does not need to create its own window.</div>

<div style><br></div><div style><br></div><div style>Could to please open a new bug and attach a test case?</div><div style><br></div><div style><br></div><div style>Cheers,</div><div style>Andoni</div><div style><br></div>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I would be able to fix and address all of these issues, but I'd like to know whether it would make sense and be accepted by the community.<br>
<br>
<br>
Best regards,<br>
Ilya Kulakov<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Andoni Morales Alastruey<br><br>LongoMatch:The Digital Coach<br><a href="http://www.longomatch.ylatuya.es">http://www.longomatch.ylatuya.es</a>
</div></div>