vlc | branch: master | Francois Cartegnie <[email protected]> | Fri Sep 23 16:53:24 2016 +0200| [f18dab19c22e284593d57a8728a2e95eb3da48c2] | committer: Francois Cartegnie
input: es_out: proper fix the CC selection resource leak Reverts caaac10c04a89379f0677319ef973c37d86890b5 The fix should not belong to es selection and we should set p_master directly on es creation. CC deselect on start reason is fixed by db9501d025a630358e092907aa7775f104569d45 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f18dab19c22e284593d57a8728a2e95eb3da48c2 --- src/input/es_out.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/input/es_out.c b/src/input/es_out.c index b82a293..ad971c2 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -171,6 +171,7 @@ struct es_out_sys_t }; static es_out_id_t *EsOutAdd ( es_out_t *, const es_format_t * ); +static es_out_id_t *EsOutAddSlave( es_out_t *, const es_format_t *, es_out_id_t * ); static int EsOutSend ( es_out_t *, es_out_id_t *, block_t * ); static void EsOutDel ( es_out_t *, es_out_id_t * ); static int EsOutControl( es_out_t *, int i_query, va_list ); @@ -1441,6 +1442,16 @@ static void EsOutMeta( es_out_t *p_out, const vlc_meta_t *p_meta ) */ static es_out_id_t *EsOutAdd( es_out_t *out, const es_format_t *fmt ) { +#ifndef NDEBUG + if( fmt->i_cat == SPU_ES ) + for( int i=0; i<4; i++ ) + assert( fmt->i_codec != EsOutFourccClosedCaptions[i] ); +#endif + return EsOutAddSlave( out, fmt, NULL ); +} + +static es_out_id_t *EsOutAddSlave( es_out_t *out, const es_format_t *fmt, es_out_id_t *p_master ) +{ es_out_sys_t *p_sys = out->p_sys; input_thread_t *p_input = p_sys->p_input; @@ -1547,7 +1558,7 @@ static es_out_id_t *EsOutAdd( es_out_t *out, const es_format_t *fmt ) es->p_dec_record = NULL; for( i = 0; i < 4; i++ ) es->pb_cc_present[i] = false; - es->p_master = NULL; + es->p_master = p_master; TAB_APPEND( out->p_sys->i_es, out->p_sys->es, es ); p_sys->i_id++; /* always incremented */ @@ -1866,16 +1877,6 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force ) wanted_es = es; } } - else if ( es->fmt.i_codec == EsOutFourccClosedCaptions[0] || - es->fmt.i_codec == EsOutFourccClosedCaptions[1] || - es->fmt.i_codec == EsOutFourccClosedCaptions[2] || - es->fmt.i_codec == EsOutFourccClosedCaptions[3]) - { - /* We don't want to enable on initial create since p_master - isn't set yet (otherwise we will think it's a standard - ES_SUB stream and cause a resource leak) */ - return; - } else { /* If there is no user preference, select the default subtitle @@ -2041,8 +2042,7 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block ) if( asprintf( &fmt.psz_description, _("Closed captions %u"), 1 + i ) == -1 ) fmt.psz_description = NULL; - es->pp_cc_es[i] = EsOutAdd( out, &fmt ); - es->pp_cc_es[i]->p_master = es; + es->pp_cc_es[i] = EsOutAddSlave( out, &fmt, es ); es_format_Clean( &fmt ); /* */ _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
