[vlc-devel] [PATCH] transcode: Correctly reset video drift

Laurent Aimar fenrir at elivagar.org
Fri Jun 8 15:24:49 CEST 2012


On Fri, Jun 08, 2012 at 12:27:37PM +0200, Aurélien Nephtali wrote:
> >> I think your patch is incomplete to fully fix the issue.
> >> The code is:
> >>
> >>>     if( p_sys->b_master_sync )
> >>>     {
> >>>         mtime_t i_pts = date_Get( &id->interpolated_pts ) + 1;
> >>>         if (unlikely ( p_pic->date - i_pts > MASTER_SYNC_MAX_DRIFT
> >>>               || p_pic->date - i_pts < -MASTER_SYNC_MAX_DRIFT ) )
> >>>         {
> >>>             msg_Dbg( p_stream, "drift is too high, resetting master sync" );
> >>>             date_Set( &id->interpolated_pts, p_pic->date );
> >>>             i_pts = p_pic->date + 1;
> >> I don't understand the need of this line (after the comment below).
> >>>         }
> >>>         date_Increment( &id->interpolated_pts, 1 );
> >> I think i_pts should be set to the result of the increment.
> >>>
> >>>         if( unlikely( b_need_duplicate ) )
> >>>         {
> >> [Here your patch add a missing date_Increment() ]
> >>>            if( p_sys->i_threads >= 1 )
> >>>            {
> >>>                /* We can't modify the picture, we need to duplicate it */
> >>>                p_pic2 = video_new_buffer_decoder( id->p_decoder );
> >>>                if( likely( p_pic2 != NULL ) )
> >>>                {
> >>>                    picture_Copy( p_pic2, p_pic );
> >>>                    p_pic2->date = i_pts;
> >>>                }
> >>>            }
> >>>            else
> >>>            {
> >>>                block_t *p_block;
> >>>                p_pic->date = i_pts;
> >>>                p_block = id->p_encoder->pf_encode_video(id->p_encoder, p_pic);
> >>>                block_ChainAppend( out, p_block );
> >>>            }
> >>>        }
> >>>     }
> >>
> >> Could you recheck against your test cases?
> >>
> >
> > With my patch and your suggestion it still works.
> > I will test this with more streams to see if it is OK.
> >
> 
> In fact, the result is not good at all. The video is not smooth even
> with a clean stream.
> My first test was wrong (I just tested quality).
> 
> You can see the results here :
>     - http://86.65.94.103/ok.ts (only my patch)
>     - http://86.65.94.103/ko.ts (my patch + your suggestion)
> 
> This is the dump that makes vlc-git duplicates each frame on a
> particular glitch (during the Jeep ad) but this time the "not smooth"
> effect is visible since the start of the encoding.
 Could you send the patch you tested?

-- 
fenrir



More information about the vlc-devel mailing list