19.10.13 04:39, Dan Dennedy написав(ла):
> On Thu, Oct 17, 2013 at 9:14 AM, Maksym Veremeyenko<ve...@m1stereo.tv>  wrote:
>> Hi,
>>
>> attached patch prevent start new (or additional) consumer_read_ahead_start
>> from avformat consumer during stopping/closing consumer.
>
> I do not like that you removed "priv->ahead = 0;" from
> mlt_consumer_stop(). Please explain; was that really necessary to fix
> your problem? The other parts look good.

first it:

1598:        // Cancel the read ahead threads
1598:        priv->ahead = 0;

and then trying to stop consumer module thread:

1609:        // Invoke the child callback
1610:        if ( self->stop != NULL )
1611:                self->stop( self );

and it waiting for thread finished. internal consumer thread is trying 
to call mlt_consumer_rt_frame.  that function if priv->ahead is not 
running and trying to call consumer_read_ahead_start

1521:                if ( priv->ahead == 0 )
1522:                {
1523:                        int buffer = mlt_properties_get_int( 
properties, "buffer" );
1524:                        int prefill = mlt_properties_get_int( 
properties, "prefill" );
1525:                        consumer_read_ahead_start( self );
1526:                        if ( buffer > 1 )
1527:                                size = prefill > 0 && prefill < 
buffer ? prefill : buffer;
1528:                }

that successfully starting consumer_read_ahead_thread again:

1089:                if ( pthread_create( &priv->ahead_thread, 
&thread_attributes, consumer_read_ahead_thread, self ) < 0 )
1090:                        pthread_create( &priv->ahead_thread, NULL, 
consumer_read_ahead_thread, self );

or

1095:                pthread_create( &priv->ahead_thread, NULL, 
consumer_read_ahead_thread, self );

my patch trying to prevent that behaviour by /two hands/ and i think 
checking priv->started could be enough - at least i will hardly check it 
in a day or two...

may be name priv->ahead is kind ambiguous and could be renamed into 
something like priv->flag_exit ....

-- 
________________________________________
Maksym Veremeyenko


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to