diff options
author | Ivan Schreter <schreter@gmx.net> | 2009-02-27 21:28:41 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2009-02-27 21:28:41 +0000 |
commit | 03831f462e8e70eae80fcef71961161995f3c3b8 (patch) | |
tree | b508a8fbaa818f92a73a391f69ae63379cdeba6f /libavcodec | |
parent | 92971e91ecab34b296dccffa02ab3cb6ea95d9fa (diff) | |
download | ffmpeg-streaming-03831f462e8e70eae80fcef71961161995f3c3b8.zip ffmpeg-streaming-03831f462e8e70eae80fcef71961161995f3c3b8.tar.gz |
Correctly reset SEI variables.
Patch by Ivan Schreter, schreter gmx net
Originally committed as revision 17651 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h264.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index bfa78e8..3322877 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2161,6 +2161,18 @@ static av_cold void common_init(H264Context *h){ memset(h->pps.scaling_matrix8, 16, 2*64*sizeof(uint8_t)); } +/** + * Reset SEI values at the beginning of the frame. + * + * @param h H.264 context. + */ +static void reset_sei(H264Context *h) { + h->sei_recovery_frame_cnt = -1; + h->sei_dpb_output_delay = 0; + h->sei_cpb_removal_delay = -1; + h->sei_buffering_period_present = 0; +} + static av_cold int decode_init(AVCodecContext *avctx){ H264Context *h= avctx->priv_data; MpegEncContext * const s = &h->s; @@ -2197,10 +2209,7 @@ static av_cold int decode_init(AVCodecContext *avctx){ h->thread_context[0] = h; h->outputed_poc = INT_MIN; h->prev_poc_msb= 1<<16; - h->sei_recovery_frame_cnt = -1; - h->sei_dpb_output_delay = 0; - h->sei_cpb_removal_delay = -1; - h->sei_buffering_period_present = 0; + reset_sei(h); if(avctx->codec_id == CODEC_ID_H264) avctx->ticks_per_frame = 2; return 0; @@ -3137,10 +3146,7 @@ static void flush_dpb(AVCodecContext *avctx){ if(h->s.current_picture_ptr) h->s.current_picture_ptr->reference= 0; h->s.first_field= 0; - h->sei_recovery_frame_cnt = -1; - h->sei_dpb_output_delay = 0; - h->sei_cpb_removal_delay = -1; - h->sei_buffering_period_present = 0; + reset_sei(h); ff_mpeg_flush(avctx); } @@ -7407,6 +7413,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ h->current_slice = 0; if (!s->first_field) s->current_picture_ptr= NULL; + reset_sei(h); } for(;;){ @@ -7744,10 +7751,6 @@ static int decode_frame(AVCodecContext *avctx, ff_er_frame_end(s); MPV_frame_end(s); - h->sei_recovery_frame_cnt = -1; - h->sei_dpb_output_delay = 0; - h->sei_cpb_removal_delay = -1; - h->sei_buffering_period_present = 0; if (cur->field_poc[0]==INT_MAX || cur->field_poc[1]==INT_MAX) { /* Wait for second field. */ |