diff options
Diffstat (limited to 'libavformat/rtpdec_hevc.c')
-rw-r--r-- | libavformat/rtpdec_hevc.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c index 3ed7cac8f6..3926614dae 100644 --- a/libavformat/rtpdec_hevc.c +++ b/libavformat/rtpdec_hevc.c @@ -2,24 +2,25 @@ * RTP parser for HEVC/H.265 payload format (draft version 6) * Copyright (c) 2014 Thomas Volkert <thomas@homer-conferencing.com> * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ +#include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/base64.h" @@ -104,7 +105,8 @@ static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s, } else if (!strcmp(attr, "sprop-sei")) { data_ptr = &hevc_data->sei; size_ptr = &hevc_data->sei_size; - } + } else + av_assert0(0); while (*value) { char base64packet[1024]; @@ -389,6 +391,7 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx av_dlog(ctx, " FU type %d with %d bytes\n", fu_type, len); + /* sanity check for size of input packet: 1 byte payload at least */ if (len > 0) { new_nal_header[0] = (rtp_pl[0] & 0x81) | (fu_type << 1); new_nal_header[1] = rtp_pl[1]; @@ -417,11 +420,14 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx memcpy(pkt->data, buf, len); } } else { - /* sanity check for size of input packet: 1 byte payload at least */ - av_log(ctx, AV_LOG_ERROR, - "Too short RTP/HEVC packet, got %d bytes of NAL unit type %d\n", - len, nal_type); - res = AVERROR_INVALIDDATA; + if (len < 0) { + av_log(ctx, AV_LOG_ERROR, + "Too short RTP/HEVC packet, got %d bytes of NAL unit type %d\n", + len, nal_type); + res = AVERROR_INVALIDDATA; + } else { + res = AVERROR(EAGAIN); + } } break; |