---
 libavcodec/h264_sei.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 1d7ec12..704c950 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -57,7 +57,7 @@ static int decode_picture_timing(H264Context *h)
         h->sei_ct_type    = 0;
 
         if (h->sei_pic_struct > SEI_PIC_STRUCT_FRAME_TRIPLING)
-            return -1;
+            return AVERROR_INVALIDDATA;
 
         num_clock_ts = sei_num_clock_ts_table[h->sei_pic_struct];
 
@@ -102,7 +102,7 @@ static int decode_unregistered_user_data(H264Context *h, 
int size)
     int e, build, i;
 
     if (size < 16)
-        return -1;
+        return AVERROR_INVALIDDATA;
 
     for (i = 0; i < sizeof(user_data) - 1 && i < size; i++)
         user_data[i] = get_bits(&h->gb, 8);
@@ -141,7 +141,7 @@ static int decode_buffering_period(H264Context *h)
     sps_id = get_ue_golomb_31(&h->gb);
     if (sps_id > 31 || !h->sps_buffers[sps_id]) {
         av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %d referenced in 
buffering period\n", sps_id);
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
     sps = h->sps_buffers[sps_id];
 
@@ -168,6 +168,7 @@ int ff_h264_decode_sei(H264Context *h)
     while (get_bits_left(&h->gb) > 16) {
         int size = 0;
         int type = 0;
+        int ret  = 0;
 
         do {
             type += show_bits(&h->gb, 8);
@@ -179,24 +180,22 @@ int ff_h264_decode_sei(H264Context *h)
 
         switch (type) {
         case SEI_TYPE_PIC_TIMING: // Picture timing SEI
-            if (decode_picture_timing(h) < 0)
-                return -1;
+            ret = decode_picture_timing(h);
             break;
         case SEI_TYPE_USER_DATA_UNREGISTERED:
-            if (decode_unregistered_user_data(h, size) < 0)
-                return -1;
+            ret = decode_unregistered_user_data(h, size);
             break;
         case SEI_TYPE_RECOVERY_POINT:
-            if (decode_recovery_point(h) < 0)
-                return -1;
+            ret = decode_recovery_point(h);
             break;
         case SEI_BUFFERING_PERIOD:
-            if (decode_buffering_period(h) < 0)
-                return -1;
+            ret = decode_buffering_period(h);
             break;
         default:
             skip_bits(&h->gb, 8 * size);
         }
+        if (ret < 0)
+            return ret;
 
         //FIXME check bits here
         align_get_bits(&h->gb);
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to