diff options
Diffstat (limited to 'libavformat/rtpdec_hevc.c')
-rw-r--r-- | libavformat/rtpdec_hevc.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c index ef47388..6ceae44 100644 --- a/libavformat/rtpdec_hevc.c +++ b/libavformat/rtpdec_hevc.c @@ -2,36 +2,39 @@ * 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" +#include "libavcodec/get_bits.h" #include "avformat.h" #include "rtpdec.h" #include "rtpdec_formats.h" -#define RTP_HEVC_PAYLOAD_HEADER_SIZE 2 -#define RTP_HEVC_FU_HEADER_SIZE 1 -#define RTP_HEVC_DONL_FIELD_SIZE 2 -#define RTP_HEVC_DOND_FIELD_SIZE 1 -#define HEVC_SPECIFIED_NAL_UNIT_TYPES 48 +#define RTP_HEVC_PAYLOAD_HEADER_SIZE 2 +#define RTP_HEVC_FU_HEADER_SIZE 1 +#define RTP_HEVC_DONL_FIELD_SIZE 2 +#define RTP_HEVC_DOND_FIELD_SIZE 1 +#define RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE 2 +#define HEVC_SPECIFIED_NAL_UNIT_TYPES 48 /* SDP out-of-band signaling data */ struct PayloadContext { @@ -83,7 +86,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); ff_h264_parse_sprop_parameter_sets(s, data_ptr, size_ptr, value); @@ -266,7 +270,7 @@ static int hevc_handle_packet(AVFormatContext *ctx, PayloadContext *rtp_hevc_ctx len -= RTP_HEVC_DONL_FIELD_SIZE; } - res = ff_h264_handle_aggregated_packet(ctx, pkt, buf, len, + res = ff_h264_handle_aggregated_packet(ctx, rtp_hevc_ctx, pkt, buf, len, rtp_hevc_ctx->using_donl_field ? RTP_HEVC_DOND_FIELD_SIZE : 0, NULL, 0); @@ -307,12 +311,16 @@ 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) { - /* 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); - return 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); + return AVERROR_INVALIDDATA; + } else { + return AVERROR(EAGAIN); + } } if (first_fragment && last_fragment) { |