[vlc-devel] commit: Clean up the code a bit, turning to be half as laggy as the previous code, but it will need to be properly fixed. ( Felix Paul Kühne )

Pierre d'Herbemont pdherbemont at free.fr
Thu Jun 12 12:56:34 CEST 2008


On Jun 12, 2008, at 4:34 AM, git version control wrote:
> +    /* Set up p_demux */
> +    p_demux->pf_demux = Demux;
> +    p_demux->pf_control = Control;
> +    p_demux->info.i_update = 0;
> +    p_demux->info.i_title = 0;
> +    p_demux->info.i_seekpoint = 0;
> +
> +    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
> +    if( !p_sys ) return VLC_ENOMEM;
> +
> +    memset( p_sys, 0, sizeof( demux_sys_t ) );
> +    memset( &fmt, 0, sizeof( es_format_t ) );
> +
>     msg_Dbg( p_demux, "QTCapture Probed" );

Any reason for that? No need to malloc() the p_sys if we can't probe  
it... Not a big deal, but...

>
>
> error:
>     [input release];
> -    [session release];
> -    [input release];
> -    [output release];
> +    [p_sys->device release];
> +    [p_sys->output release];
> +    [p_sys->session release];

...This is wrong. In case of error you end up in a double free.

     NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

> NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>
> +    @synchronized (p_sys->output) {
>     p_block->i_pts = [p_sys->output copyCurrentFrameToBuffer:  
> p_block->p_buffer];
> +    }

No need to lock here. Why would you do that copyCurrentFrameToBuffer:?  
already takes care of that.

> -        currentPts = [sampleBuffer presentationTime].timeValue /  
> [sampleBuffer presentationTime].timeScale;
> +        currentPts = [sampleBuffer presentationTime].timeValue;

Any explanation on that one?

Pierre.



More information about the vlc-devel mailing list