[FFmpeg-devel] [PATCH] set bitrate from rc_max_rate for duration estimation will fix ticket #3678

Marc-Antoine Arnaud marcantoine.arnaud at arkena.com
Wed Aug 20 15:37:58 CEST 2014


From: Marc-Antoine Arnaud <arnaud.marcantoine at gmail.com>

---
 libavformat/utils.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index b4ca342..738d1f0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2280,6 +2280,13 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
                 }
                 bit_rate += st->codec->bit_rate;
             }
+            if (st->codec->rc_max_rate > 0) {
+                if (INT_MAX - st->codec->rc_max_rate < bit_rate) {
+                    bit_rate = 0;
+                    break;
+                }
+                bit_rate += st->codec->rc_max_rate;
+            }
         }
         ic->bit_rate = bit_rate;
     }
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list