Guest User

Untitled

a guest
Sep 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.17 KB | None | 0 0
  1. diff --git a/libavcodec/utvideoenc.c b/libavcodec/utvideoenc.c
  2. index f650c4f..a16c144 100644
  3. --- a/libavcodec/utvideoenc.c
  4. +++ b/libavcodec/utvideoenc.c
  5. @@ -623,19 +623,18 @@ static int utvideo_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
  6.      int i, ret = 0;
  7.  
  8.      /* Allocate a new packet if needed, and set it to the pointer dst */
  9. -    if (!pkt->data)
  10. -        ret = av_new_packet(pkt, (256 + 4 * c->slices +
  11. -                            width * height) * c->planes + 4);
  12. +    ret = ff_alloc_packet(pkt, (256 + 4 * c->slices + width * height) *
  13. +                          c->planes + 4);
  14.  
  15. -    if (ret) {
  16. -        av_log(avctx, AV_LOG_ERROR, "Error allocating output packet.\n");
  17. +    if (ret < 0) {
  18. +        av_log(avctx, AV_LOG_ERROR,
  19. +               "Error allocating or using the output packet.\n");
  20.          return ret;
  21.      }
  22.  
  23.      dst = pkt->data;
  24.  
  25. -    bytestream2_init_writer(&pb, dst, (256 + 4 * c->slices +
  26. -                            width * height) * c->planes + 4);
  27. +    bytestream2_init_writer(&pb, dst, pkt->size);
  28.  
  29.      av_fast_malloc(&c->slice_bits, &c->slice_bits_size,
  30.                     width * height + FF_INPUT_BUFFER_PADDING_SIZE);
Add Comment
Please, Sign In to add comment