[FFmpeg-cvslog] h264: Calculate a tighter recovery_frame.

Michael Niedermayer git at videolan.org
Mon Oct 24 12:25:25 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Oct 24 12:17:24 2011 +0200| [35075dc65041899eb6049dc80095b3f26847469e] | committer: Michael Niedermayer

h264: Calculate a tighter recovery_frame.
Reduces delay with mplayers TS demuxer.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35075dc65041899eb6049dc80095b3f26847469e
---

 libavcodec/h264.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index b353bee..ce633ea 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3863,7 +3863,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
             if((err = decode_slice_header(hx, h)))
                break;
 
-            if (h->sei_recovery_frame_cnt >= 0 && h->recovery_frame < 0) {
+            if (   h->sei_recovery_frame_cnt >= 0
+                && (h->recovery_frame - h->frame_num) & ((1 << h->sps.log2_max_frame_num)-1) > h->sei_recovery_frame_cnt) {
                 h->recovery_frame = (h->frame_num + h->sei_recovery_frame_cnt) %
                                     (1 << h->sps.log2_max_frame_num);
             }



More information about the ffmpeg-cvslog mailing list