Skip to content

[3.0.x] transcode: fix destructive assignment after drain

Alaric Senat requested to merge asenat/vlc:3.0-fix-transcode-drain into 3.0.x

The drain checks are done after the first encoder output fetch. At this point, out is already filled with some frames gotten from the encoder some lines above:

// ...
    if( p_sys->i_threads >= 1 )
    {
        /* Pick up any return data the encoder thread wants to output. */
        vlc_mutex_lock( &p_sys->lock_out );
        *out = p_sys->p_buffers;
        p_sys->p_buffers = NULL;
        vlc_mutex_unlock( &p_sys->lock_out );
    }

// ...

This assignment currently leaks all previously gathered frames to replace them by the drained output. This patch appends the drained frames to the existing output instead.

This is a 3.0 only patch. This issue has been silently fixed by Alexandre's reworks in d8c883e2.

Merge request reports