diff options
author | Anton Khirnov <anton@khirnov.net> | 2017-05-01 21:42:54 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-04-10 15:52:41 +0200 |
commit | 5e316096fa9ba4493d9dbb48847ad8e0b0e188c3 (patch) | |
tree | c0c6cb248b47ef3b71dbb83bb8f4756d45ac86cd /libavcodec/h264_parser.c | |
parent | ec7f33a38e341807c0ff9530e4dc7e175a86f437 (diff) | |
download | ffmpeg-5e316096fa9ba4493d9dbb48847ad8e0b0e188c3.tar.gz |
h264_ps: make the PPS hold a reference to its SPS
It represents the relationship between them more naturally and will be
useful in the following commits.
Allows significantly more frames in fate-h264-attachment-631 to be
decoded.
Diffstat (limited to 'libavcodec/h264_parser.c')
-rw-r--r-- | libavcodec/h264_parser.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index ec1cbc6a66..aacd44cf3b 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -361,26 +361,14 @@ static inline int parse_nal_units(AVCodecParserContext *s, } av_buffer_unref(&p->ps.pps_ref); - av_buffer_unref(&p->ps.sps_ref); p->ps.pps = NULL; p->ps.sps = NULL; p->ps.pps_ref = av_buffer_ref(p->ps.pps_list[pps_id]); if (!p->ps.pps_ref) goto fail; p->ps.pps = (const PPS*)p->ps.pps_ref->data; - - if (!p->ps.sps_list[p->ps.pps->sps_id]) { - av_log(avctx, AV_LOG_ERROR, - "non-existing SPS %u referenced\n", p->ps.pps->sps_id); - goto fail; - } - - p->ps.sps_ref = av_buffer_ref(p->ps.sps_list[p->ps.pps->sps_id]); - if (!p->ps.sps_ref) - goto fail; - p->ps.sps = (const SPS*)p->ps.sps_ref->data; - - sps = p->ps.sps; + p->ps.sps = p->ps.pps->sps; + sps = p->ps.sps; // heuristic to detect non marked keyframes if (p->ps.sps->ref_frame_count <= 1 && p->ps.pps->ref_count[0] <= 1 && s->pict_type == AV_PICTURE_TYPE_I) |