[mythtv] FFmpeg 4.4.1 problems

Peter Bennett pb.mythtv at gmail.com
Thu Nov 25 01:39:20 UTC 2021


On 11/24/21 3:55 PM, Klaas de Waal wrote:
> The cause for the blocking artifacts with VDPAU playback start and 
> skipping is the following commit in release 4.4 of ffmpeg:
>
> [klaas at modu ffmpeg]$ git show 99042c2bf6
> commit 99042c2bf6cc79006036502a6abbec5e51f73673
> Author: James Almer <jamrial at gmail.com <mailto:jamrial at gmail.com>>
> Date:   Mon Mar 8 23:10:10 2021 -0300
>
>     avcodec/h264_slice: don't copy frame data during error concealment
>
>     In addition to the fact that av_image_copy() cannot handle 
> hardware pixel formats,
>     h->short_ref[0]->f may not be writable at this point.
>
>     Based on a patch by Hendrik Leppkes.
>
>     Signed-off-by: James Almer <jamrial at gmail.com 
> <mailto:jamrial at gmail.com>>
>
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index fa7a639053..14b945756b 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -1599,14 +1599,15 @@ static int h264_field_start(H264Context *h, 
> const H264SliceContext *sl,
>                  ff_thread_await_progress(&prev->tf, INT_MAX, 0);
>                  if (prev->field_picture)
>  ff_thread_await_progress(&prev->tf, INT_MAX, 1);
> -  av_image_copy(h->short_ref[0]->f->data,
> -  h->short_ref[0]->f->linesize,
> -                              (const uint8_t **)prev->f->data,
> -                              prev->f->linesize,
> -                              prev->f->format,
> -                              prev->f->width,
> -                              prev->f->height);
> +                ff_thread_release_buffer(h->avctx, &h->short_ref[0]->tf);
> +                h->short_ref[0]->tf.f = h->short_ref[0]->f;
> +                ret = ff_thread_ref_frame(&h->short_ref[0]->tf, 
> &prev->tf);
> +                if (ret < 0)
> +                    return ret;
>                  h->short_ref[0]->poc = prev->poc + 2U;
> +  ff_thread_report_progress(&h->short_ref[0]->tf, INT_MAX, 0);
> +                if (h->short_ref[0]->field_picture)
> +  ff_thread_report_progress(&h->short_ref[0]->tf, INT_MAX, 1);
>              } else if (!h->frame_recovered && !h->avctx->hwaccel)
>                  ff_color_frame(h->short_ref[0]->f, c);
>              h->short_ref[0]->frame_num = h->poc.prev_frame_num;
>
>
> The attached patch reverses the above commit and can be applied to the 
> devel/ffmpeg-resync branch.
>
> Klaas.
>
Thank you. Great work. I plan to combine the list of commits that Scott 
Theisen created, plus the pull request that he created for eliminating 
unnecessary code that is no longer used, plus this, and use a new 
methodology as suggested by Piotr, to take the FFmpeg code and apply our 
patches on it, rather than merging the FFmpeg version with our code.

The list of our patches can be stored somewhere and updated as necessary 
so that it can be applied to each new FFmpeg version. Alternatively, 
once the patches have been applied to a version, they can be extracted 
again using git format-patch and applied to the next version with git 
am. This could also pick up any new patches that were subsequently 
applied to our FFmpeg code, although hopefully these could be kept to a 
minimum.

Peter


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20211124/002332ca/attachment.htm>


More information about the mythtv-dev mailing list