[vlc-commits] codec: videotoolbox: fix divbyzero

Francois Cartegnie git at videolan.org
Mon Apr 17 16:00:56 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Apr 17 16:00:14 2017 +0200| [fe9ff8e149df6d5b2a2616b9714ca8f878820c34] | committer: Francois Cartegnie

codec: videotoolbox: fix divbyzero

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fe9ff8e149df6d5b2a2616b9714ca8f878820c34
---

 modules/codec/videotoolbox.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 7e2d0ff034..4e1820370a 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -256,7 +256,8 @@ static bool ParseH264NAL(decoder_t *p_dec,
                     p_info->b_top_field_first = (sei.i_pic_struct % 2 == 1);
 
                 /* Set frame rate for timings in case of missing rate */
-                if( !p_dec->fmt_in.video.i_frame_rate_base &&
+                if( (!p_dec->fmt_in.video.i_frame_rate_base ||
+                     !p_dec->fmt_in.video.i_frame_rate) &&
                     p_sps->vui.i_time_scale && p_sps->vui.i_num_units_in_tick )
                 {
                     date_Change( &p_sys->pts, p_sps->vui.i_time_scale,
@@ -629,7 +630,7 @@ static int StartVideoToolbox(decoder_t *p_dec)
     const unsigned i_sar_num = p_dec->fmt_out.video.i_sar_num;
     const unsigned i_sar_den = p_dec->fmt_out.video.i_sar_den;
 
-    if( p_dec->fmt_in.video.i_frame_rate_base )
+    if( p_dec->fmt_in.video.i_frame_rate_base && p_dec->fmt_in.video.i_frame_rate )
     {
         date_Init( &p_sys->pts, p_dec->fmt_in.video.i_frame_rate * 2,
                                 p_dec->fmt_in.video.i_frame_rate_base );



More information about the vlc-commits mailing list