X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Frtmp%2Faccess.c;h=14c9f4f41df23fc8faffda4b6c8538657e735e88;hb=0597403277c49d3fc23da19fb6f6954e984bae86;hp=c0bf34706f7bb6802dbdc5feb4fbc7e16a29dae2;hpb=0d65e1f8019f44741d1dc56289831d5b2560b0e2;p=vlc diff --git a/modules/access/rtmp/access.c b/modules/access/rtmp/access.c index c0bf34706f..14c9f4f41d 100644 --- a/modules/access/rtmp/access.c +++ b/modules/access/rtmp/access.c @@ -48,19 +48,19 @@ static int Open ( vlc_object_t * ); static void Close( vlc_object_t * ); -vlc_module_begin(); - set_description( N_("RTMP input") ); - set_shortname( N_("RTMP") ); - set_category( CAT_INPUT ); - set_subcategory( SUBCAT_INPUT_ACCESS ); +vlc_module_begin () + set_description( N_("RTMP input") ) + set_shortname( N_("RTMP") ) + set_category( CAT_INPUT ) + set_subcategory( SUBCAT_INPUT_ACCESS ) add_integer( "rtmp-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT, CACHING_LONGTEXT, true ); - set_capability( "access", 0 ); - set_callbacks( Open, Close ); - add_shortcut( "rtmp" ); -vlc_module_end(); + set_capability( "access", 0 ) + set_callbacks( Open, Close ) + add_shortcut( "rtmp" ) +vlc_module_end () /***************************************************************************** @@ -115,7 +115,10 @@ static int Open( vlc_object_t *p_this ) } length_path = strlen( p_sys->p_thread->url.psz_path ); - length_media_name = strlen( strrchr( p_sys->p_thread->url.psz_path, '/' ) ) - 1; + char* psz_tmp = strrchr( p_sys->p_thread->url.psz_path, '/' ); + if( !psz_tmp ) + goto error; + length_media_name = strlen( psz_tmp ) - 1; p_sys->p_thread->psz_application = strndup( p_sys->p_thread->url.psz_path + 1, length_path - length_media_name - 2 ); p_sys->p_thread->psz_media = strdup( p_sys->p_thread->url.psz_path + ( length_path - length_media_name ) ); @@ -157,7 +160,7 @@ static int Open( vlc_object_t *p_this ) p_sys->p_thread->p_base_object = p_this; - vlc_cond_init( p_sys->p_thread, &p_sys->p_thread->wait ); + vlc_cond_init( &p_sys->p_thread->wait ); vlc_mutex_init( &p_sys->p_thread->lock ); @@ -209,7 +212,7 @@ static int Open( vlc_object_t *p_this ) } if( vlc_thread_create( p_sys->p_thread, "rtmp control thread", ThreadControl, - VLC_THREAD_PRIORITY_INPUT, false ) ) + VLC_THREAD_PRIORITY_INPUT ) ) { msg_Err( p_access, "cannot spawn rtmp control thread" ); goto error2; @@ -264,7 +267,6 @@ static void Close( vlc_object_t * p_this ) /* p_sys->p_thread->b_die = true;*/ vlc_object_kill( p_sys->p_thread ); block_FifoWake( p_sys->p_thread->p_fifo_input ); - block_FifoWake( p_sys->p_thread->p_empty_blocks ); vlc_thread_join( p_sys->p_thread ); @@ -507,6 +509,7 @@ static void* ThreadControl( vlc_object_t *p_this ) { rtmp_control_thread_t *p_thread = (rtmp_control_thread_t *) p_this; rtmp_packet_t *rtmp_packet; + int canc = vlc_savecancel (); rtmp_init_handler( p_thread->rtmp_handler ); @@ -543,5 +546,6 @@ static void* ThreadControl( vlc_object_t *p_this ) block_FifoWake( p_thread->p_fifo_input ); } } + vlc_restorecancel (canc); return NULL; }