[vlc-devel] Video quality patches for vlc (based on 0.9.8a)

xxcv xxcv07 at gmail.com
Fri Apr 10 14:05:28 CEST 2009


Bryan Moore wrote:
>
>  
>
> See three "FIX" items below
>
>  
>
> [ Re-submitting because it didn't show up in the digest as I wasn't 
> yet in vlc-devel. ]
>
>  
>
> ref:  
> "http://forum.videolan.org/viewtopic.php?f=7&t=57973&p=193157#p193157 
> <http://forum.videolan.org/viewtopic.php?f=7&t=57973&p=193157#p193157>"
>
>  
>
> Based on information that was explained in detail in the above post, 
> we are proposing 3 sets of patches to vlc to correct problems that 
> reduce video playback quality, particularly for streaming H.264 video, 
> and also video playback via X11 and XVideo (in general).
>
>  
>
> As stated in the subject line, these patches were tested on 0.9.8a and 
> appear to apply as well to the latest 'git' repository fetch.
>
>  
>
> NOTE:  code changes surrounded by comments, 'Airgain begin' and 
> 'Airgain end'
>
>  
>
> FIX #1: frame buffer size
>
>  
>
> modules/demux/live555.cpp file, function 'SessionsSetup', assignments 
> to 'tk->' members: use 'i_buffer' in lieu of hard-coded
>
> 65536 for initial buffer size.
>
>  
>
>   // Airgain begin - increase video buffer to 'i_buffer' bytes (see above)
>
>   // tk->i_buffer = 65536;
>
>   // tk->p_buffer = (uint8_t *)malloc( 65536 );
>
>   tk->i_buffer = i_buffer;
>
>   tk->p_buffer = (uint8_t *)malloc( i_buffer );
>
>   // Airgain end
>
>  
>
>  
>
> FIX #2: correct I-frame timing
>
>  
>
> file include/vlc_block.h, function 'block_ChainExtract'
>
>  
>
>  
>
> static size_t block_ChainExtract( block_t *p_list, void *p_data, 
> size_t i_max )
>
> {
>
>    size_t i_total = 0;
>
>    uint8_t *p = (uint8_t*)p_data;
>
>    // Airgain begin
>
>    block_t *p_list0 = p_list;
>
>    // Airgain end
>
>  
>
>    while( p_list && i_max )
>
>    {
>
>      size_t i_copy = __MIN( i_max, p_list->i_buffer );
>
>      memcpy( p, p_list->p_buffer, i_copy );
>
>      i_max -= i_copy;
>
>      i_total += i_copy;
>
>      p += i_copy;
>
>      // Airgain begin
>
>      if(!p_list0->i_dts && !p_list0->i_pts)
>
>      {
>
>        p_list0->i_dts = p_list->i_dts;
>
>        p_list0->i_pts = p_list->i_pts;
>
>      }
>
>      // Airgain end
>
>      p_list = p_list->p_next;
>
>    }
>
>    return i_total;
>
> }
>
>  
>
> file modules/packetizer/h264.c, function 'ParseNALBlock', near the end
>
>  
>
>    /* Append the block */
>
>    if( p_frag )
>
>      block_ChainAppend( &p_sys->p_frame, p_frag );
>
>  
>
>    *pb_used_ts = false;
>
>    if( p_sys->i_frame_dts < 0 && p_sys->i_frame_pts < 0 )
>
>    {
>
>      // Airgain begin - if B frame or i_frag_pts is zero, do NOT 
> assign frame [pd]ts !
>
>      if(i_frag_pts && p_sys->slice.i_frame_type != 8)
>
>      {
>
>      // Airgain end
>
>      p_sys->i_frame_dts = i_frag_dts;
>
>      p_sys->i_frame_pts = i_frag_pts;
>
>      *pb_used_ts = true;
>
>      // Airgain begin
>
>      }
>
>      // Airgain end
>
>    }
>
>    return p_pic;
>
> }
>
>  
>
> file modules/packetizer/h264.c, function 'OutputPicture', also near 
> the end
>
>  
>
>    else
>
>    {
>
>      p_pic = block_ChainGather( p_sys->p_frame );
>
>    }
>
>    // Airgain begin - do not assign i_[pd]ts from frame [pd]ts unless 
> mine are <= 0
>
>    if(p_pic->i_dts <= 0 && p_pic->i_pts <= 0)
>
>    {
>
>    // Airgain end
>
>    p_pic->i_dts = p_sys->i_frame_dts;
>
>    p_pic->i_pts = p_sys->i_frame_pts;
>
>    // Airgain begin
>
>    }
>
>    // Airgain end
>
>    p_pic->i_length = 0; /* FIXME */
>
>    p_pic->i_flags |= p_sys->slice.i_frame_type;
>
>  
>
>    p_sys->slice.i_frame_type = 0;
>
>    p_sys->p_frame = NULL;
>
>    p_sys->i_frame_dts = -1;
>
>    p_sys->i_frame_pts = -1;
>
>    p_sys->b_slice = false;
>
>  
>
>    return p_pic;
>
> }
>
>  
>
>  
>
>  
>
> FIX #3:  (X11 only) - using XFlush + usleep to send commands to 
> XServer and thread-switch _before_ XSync
>
>  
>
>  
>
> file modules/video_output/x11/xcommon.c, function 'DisplayVideo', near 
> the end
>
>  
>
>  
>
>    }
>
>  
>
>    // Airgain begin - XFlush to send commands, usleep to force context 
> switch.
>
>    // This is likely to help client/server interaction
>
>    XFlush( p_vout->p_sys->p_display ); // force commands to be sent
>
>    usleep(500); // then switch contexts before waiting
>
>    // Airgain end
>
>  
>
>    /* Make sure the command is sent now - do NOT use XFlush !*/
>
>    XSync( p_vout->p_sys->p_display, False );
>
>  
>
>    vlc_mutex_unlock( &p_vout->p_sys->lock );
>
> }
>
>  
>
> Regards,
>
> Bryan M for Bob F
>
> http://www.Airgain.com <http://www.airgain.com/>
>
>  
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>   

Have you tested? will not break any other rtsp live555 stream e.g mpeg-2ts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090410/3b045459/attachment.html>


More information about the vlc-devel mailing list