vlc | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Wed Nov 4 13:23:53 2020 +0100| [9f2ce559c11255af05ad9f72964c5ca8a99f486b] | committer: Hugo Beauzée-Luyssen
input: Compare attachments themselves when updating them Since they are now refcounted, we can compare the pointers themselves instead of relying on the demux they originally came from. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f2ce559c11255af05ad9f72964c5ca8a99f486b --- src/input/input.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/input/input.c b/src/input/input.c index 7f586deef7..b50b08e953 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -3091,25 +3091,26 @@ static void InputUpdateMeta( input_thread_t *p_input, demux_t *p_demux ) if( !demux_Control( p_demux, DEMUX_GET_ATTACHMENTS, &attachment, &i_attachment ) ) { - vlc_mutex_lock( &input_priv(p_input)->p_item->lock ); - if( input_priv(p_input)->i_attachment > 0 ) + input_thread_private_t *priv = input_priv(p_input); + vlc_mutex_lock( &priv->p_item->lock ); + int nb_new = 0; + for ( int i = 0; i < i_attachment; ++i ) { - int j = 0; - for( int i = 0; i < input_priv(p_input)->i_attachment; i++ ) + bool is_new = true; + for( int j = 0; j < priv->i_attachment; ++j ) { - if( input_priv(p_input)->attachment_demux[i] == p_demux ) - vlc_input_attachment_Release( input_priv(p_input)->attachment[i] ); - else + if( priv->attachment[j] == attachment[i] ) { - input_priv(p_input)->attachment[j] = input_priv(p_input)->attachment[i]; - input_priv(p_input)->attachment_demux[j] = input_priv(p_input)->attachment_demux[i]; - j++; + vlc_input_attachment_Release( attachment[i] ); + is_new = false; + break; } } - input_priv(p_input)->i_attachment = j; + if( is_new ) + attachment[nb_new++] = attachment[i]; } - AppendAttachment( p_input, i_attachment, attachment, p_demux ); - vlc_mutex_unlock( &input_priv(p_input)->p_item->lock ); + AppendAttachment( p_input, nb_new, attachment, p_demux ); + vlc_mutex_unlock( &priv->p_item->lock ); } es_out_ControlSetMeta( input_priv(p_input)->p_es_out, p_meta ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
