Changeset 6d937c8f88c36262433d5060a82f9cd3d5c69786

Show
Ignore:
Timestamp:
24/07/08 19:58:05 (4 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1216922285 +0200
git-parent:

[8e34f1cd2658337329befe2ed73ceaec2f6612e5]

git-author:
Laurent Aimar <fenrir@videolan.org> 1216922285 +0200
Message:

Fixed completely broken video filter 2 chain in vout. Now they have a
chance to get a frame when they ask (close #1738).

Decoders and filters share the same pool of video frames. But the
decoders try to decode as fast as possible, using all buffers. Then it
s pure luck if the filter can grab a frame...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_vout.h

    ra4270c7 r6d937c8  
    661661VLC_EXPORT( void,            vout_UnlinkPicture,  ( vout_thread_t *, picture_t * ) ); 
    662662VLC_EXPORT( void,            vout_PlacePicture,   ( vout_thread_t *, unsigned int, unsigned int, unsigned int *, unsigned int *, unsigned int *, unsigned int * ) ); 
     663 
     664/* DO NOT use vout_RenderPicture unless you are in src/video_ouput */ 
    663665picture_t *     vout_RenderPicture  ( vout_thread_t *, picture_t *, 
    664666                                                       subpicture_t * ); 
     667 
     668/* DO NOT use vout_CountPictureAvailable unless your are in src/input/dec.c (no exception) */ 
     669int vout_CountPictureAvailable( vout_thread_t * ); 
    665670 
    666671VLC_EXPORT( int, vout_vaControlDefault, ( vout_thread_t *, int, va_list ) ); 
  • src/input/decoder.c

    r8834505 r6d937c8  
    12361236} 
    12371237 
     1238 
     1239int vout_CountPictureAvailable( vout_thread_t *p_vout ); 
     1240 
    12381241static picture_t *vout_new_buffer( decoder_t *p_dec ) 
    12391242{ 
     
    13181321    } 
    13191322 
    1320     /* Get a new picture */ 
    1321     while( !(p_pic = vout_CreatePicture( p_sys->p_vout, 0, 0, 0 ) ) ) 
     1323    /* Get a new picture 
     1324     */ 
     1325    for( p_pic = NULL; ; ) 
    13221326    { 
    13231327        int i_pic, i_ready_pic = 0; 
    13241328 
    13251329        if( p_dec->b_die || p_dec->b_error ) 
    1326         { 
    13271330            return NULL; 
     1331 
     1332        /* The video filter chain required that there is always 1 free buffer 
     1333         * that it will use as temporary one. It will release the temporary 
     1334         * buffer once its work is done, so this check is safe even if we don't 
     1335         * lock around both count() and create(). 
     1336         */ 
     1337        if( vout_CountPictureAvailable( p_sys->p_vout ) >= 2 ) 
     1338        { 
     1339            p_pic = vout_CreatePicture( p_sys->p_vout, 0, 0, 0 ); 
     1340            if( p_pic ) 
     1341                break; 
    13281342        } 
    13291343 
  • src/misc/filter_chain.c

    rb364425 r6d937c8  
    354354        { 
    355355            vout_thread_t *p_vout = (vout_thread_t*)p_chain->p_this; 
    356  
    357356            vlc_mutex_lock( &p_vout->picture_lock ); 
    358357            if( p_pic->i_refcount ) 
  • src/video_output/vout_pictures.c

    ra4270c7 r6d937c8  
    107107 * threads. 
    108108 */ 
     109int vout_CountPictureAvailable( vout_thread_t *p_vout ) 
     110{ 
     111    int i_free = 0; 
     112    int i_pic; 
     113 
     114    vlc_mutex_lock( &p_vout->picture_lock ); 
     115    for( i_pic = 0; i_pic < I_RENDERPICTURES; i_pic++ ) 
     116    { 
     117        picture_t *p_pic = PP_RENDERPICTURE[(p_vout->render.i_last_used_pic + i_pic + 1) % I_RENDERPICTURES]; 
     118 
     119        switch( p_pic->i_status ) 
     120        { 
     121            case DESTROYED_PICTURE: 
     122                i_free++; 
     123                break; 
     124 
     125            case FREE_PICTURE: 
     126                i_free++; 
     127                break; 
     128 
     129            default: 
     130                break; 
     131        } 
     132    } 
     133    vlc_mutex_unlock( &p_vout->picture_lock ); 
     134 
     135    return i_free; 
     136} 
     137 
    109138picture_t *vout_CreatePicture( vout_thread_t *p_vout, 
    110139                               bool b_progressive,