avcodec/wavpack: use av_buffer_replace() to simplify code

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Gil Pedersen <git@gpost.dk>
Signed-off-by: James Almer <jamrial@gmail.com>
pull/358/head
Gil Pedersen 4 years ago committed by James Almer
parent 381ab69042
commit abcca6a055
  1. 7
      libavcodec/wavpack.c

@ -1024,13 +1024,12 @@ static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
return ret;
}
av_buffer_unref(&fdst->dsd_ref);
fdst->dsdctx = NULL;
fdst->dsd_channels = 0;
ret = av_buffer_replace(&fdst->dsd_ref, fsrc->dsd_ref);
if (ret < 0)
return ret;
if (fsrc->dsd_ref) {
fdst->dsd_ref = av_buffer_ref(fsrc->dsd_ref);
if (!fdst->dsd_ref)
return AVERROR(ENOMEM);
fdst->dsdctx = (DSDContext*)fdst->dsd_ref->data;
fdst->dsd_channels = fsrc->dsd_channels;
}

Loading…
Cancel
Save