Signed-off-by: Gil Pedersen <g...@gpost.dk>
---
 libavcodec/h264_slice.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index fa7a639053..b937ebebcf 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1018,11 +1018,11 @@ static int h264_init_ps(H264Context *h, const 
H264SliceContext *sl, int first_sl
     int needs_reinit = 0, must_reinit, ret;
 
     if (first_slice) {
-        av_buffer_unref(&h->ps.pps_ref);
-        h->ps.pps = NULL;
-        h->ps.pps_ref = av_buffer_ref(h->ps.pps_list[sl->pps_id]);
-        if (!h->ps.pps_ref)
-            return AVERROR(ENOMEM);
+        ret = av_buffer_replace(&h->ps.pps_ref, h->ps.pps_list[sl->pps_id]);
+        if (ret < 0) {
+            h->ps.pps = NULL;
+            return ret;
+        }
         h->ps.pps = (const PPS*)h->ps.pps_ref->data;
     }
 
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to