Skip to content

Commit

Permalink
Fix sliced pix_fmt conversion regression in c4d4e0a.
Browse files Browse the repository at this point in the history
It would crash with MLT_AVFORMAT_SLICED_PIXFMT_DISABLE defined since
ctx.slice_w was not initialized, and it was always running with one
slice with it undefined.
  • Loading branch information
ddennedy committed May 11, 2018
1 parent cdbe29d commit c71dd89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/avformat/producer_avformat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1492,16 +1492,18 @@ static int convert_image( producer_avformat self, AVFrame *frame, uint8_t *buffe
ctx.slice_w = ( width < 1000 )
? ( 256 >> frame->interlaced_frame )
: ( 512 >> frame->interlaced_frame );
} else {
ctx.slice_w = width;
}

c = ( width + ctx.slice_w - 1 ) / ctx.slice_w;
int last_slice_w = width - ctx.slice_w * (c - 1);
c *= frame->interlaced_frame ? 2 : 1;

if ( (last_slice_w % 8) || !getenv("MLT_AVFORMAT_SLICED_PIXFMT_DISABLE") ) {
ctx.slice_w = width;
if ( (last_slice_w % 8) == 0 && !getenv("MLT_AVFORMAT_SLICED_PIXFMT_DISABLE") ) {
mlt_slices_run_normal( c, sliced_h_pix_fmt_conv_proc, &ctx );
} else {
ctx.slice_w = width;
for ( i = 0 ; i < c; i++ )
sliced_h_pix_fmt_conv_proc( i, i, c, &ctx );
}
Expand Down

0 comments on commit c71dd89

Please sign in to comment.