Changeset e603af3f7901787f11bdffa5402ffeeb57402a14

Show
Ignore:
Timestamp:
21/09/03 13:48:58 (5 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1064144938 +0000
git-parent:

[7d0c93158d1afb34538de30802f9542b04db0b55]

git-author:
Gildas Bazin <gbazin@videolan.org> 1064144938 +0000
Message:

* modules/stream_out/duplicate.c: improved last fix.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/stream_out/duplicate.c

    r9a16e57 re603af3  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001, 2002 VideoLAN 
    5  * $Id: duplicate.c,v 1.3 2003/09/20 23:46:01 gbazin Exp $ 
     5 * $Id: duplicate.c,v 1.4 2003/09/21 11:48:58 gbazin Exp $ 
    66 * 
    77 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
     
    139139    sout_stream_sys_t *p_sys = p_stream->p_sys; 
    140140    sout_stream_id_t  *id; 
    141     int               i_stream
     141    int i_stream, i_valid_streams = 0
    142142 
    143143    id = malloc( sizeof( sout_stream_id_t ) ); 
     
    152152        id_new = (void*)p_sys->pp_streams[i_stream]->pf_add( 
    153153                            p_sys->pp_streams[i_stream], p_fmt ); 
    154         if( id_new ) 
    155         { 
    156             TAB_APPEND( id->i_nb_ids, id->pp_ids, id_new ); 
    157         } 
    158     } 
    159  
    160     if( id->i_nb_ids <= 0 ) 
    161     { 
    162         free( id ); 
     154 
     155        /* Append failed attempts as well to keep track of which pp_id 
     156     * belong to which duplicated stream */ 
     157        TAB_APPEND( id->i_nb_ids, id->pp_ids, id_new ); 
     158        if( id_new ) i_valid_streams++; 
     159    } 
     160 
     161    if( i_valid_streams <= 0 ) 
     162    { 
     163        Del( p_stream, id ); 
    163164        return NULL; 
    164165    } 
     
    174175    for( i_stream = 0; i_stream < p_sys->i_nb_streams; i_stream++ ) 
    175176    { 
    176         if( id->i_nb_ids > i_stream && id->pp_ids[i_stream] ) 
     177        if( id->pp_ids[i_stream] ) 
    177178        { 
    178179            p_sys->pp_streams[i_stream]->pf_del( p_sys->pp_streams[i_stream], 
     
    196197        sout_buffer_t *p_dup; 
    197198 
    198         if( id->i_nb_ids > i_stream && id->pp_ids[i_stream] ) 
     199        if( id->pp_ids[i_stream] ) 
    199200        { 
    200201            p_dup = sout_BufferDuplicate( p_stream->p_sout, p_buffer ); 
     
    207208 
    208209    i_stream = p_sys->i_nb_streams - 1; 
    209     if( id->i_nb_ids > i_stream && id->pp_ids[i_stream] ) 
     210    if( id->pp_ids[i_stream] ) 
    210211    { 
    211212        p_sys->pp_streams[i_stream]->pf_send( p_sys->pp_streams[i_stream], 
     
    213214                                              p_buffer); 
    214215    } 
     216    else 
     217    { 
     218        sout_BufferDelete( p_stream->p_sout, p_buffer ); 
     219    } 
    215220 
    216221    return VLC_SUCCESS;