[vlc-commits] packetizer: h264: do not override fmtin frame rate

Francois Cartegnie git at videolan.org
Fri Oct 11 17:28:42 CEST 2019


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 25 13:59:40 2019 +0200| [4d9b68c81504deb08f68afe56c6660a068422f44] | committer: Francois Cartegnie

packetizer: h264: do not override fmtin frame rate

(cherry picked from commit 4876193c93270343a8426d136611d9ca8e5cea66)

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

 modules/packetizer/h264.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 52043942d0..96504b3dee 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -212,28 +212,29 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
             p_dec->fmt_out.video.i_sar_den = p_sps->vui.i_sar_den;
         }
 
-        if( p_sps->vui.b_valid )
+        if( !p_dec->fmt_out.video.i_frame_rate ||
+            !p_dec->fmt_out.video.i_frame_rate_base )
         {
-            if( !p_dec->fmt_in.video.i_frame_rate_base &&
-                p_sps->vui.i_num_units_in_tick > 0 && p_sps->vui.i_time_scale > 1 )
+            /* on first run == if fmt_in does not provide frame rate info */
+            /* If we have frame rate info in the stream */
+            if(p_sps->vui.b_valid &&
+               p_sps->vui.i_num_units_in_tick > 0 &&
+               p_sps->vui.i_time_scale > 1 )
             {
-                const unsigned i_rate_base = p_sps->vui.i_num_units_in_tick;
-                const unsigned i_rate = p_sps->vui.i_time_scale >> 1; /* num_clock_ts == 2 */
-                if( i_rate_base != p_dec->fmt_out.video.i_frame_rate_base ||
-                    i_rate != p_dec->fmt_out.video.i_frame_rate )
-                {
-                    p_dec->fmt_out.video.i_frame_rate_base = i_rate_base;
-                    p_dec->fmt_out.video.i_frame_rate = i_rate;
-                    date_Change( &p_sys->dts, p_sps->vui.i_time_scale, p_sps->vui.i_num_units_in_tick );
-                }
+                date_Change( &p_sys->dts, p_sps->vui.i_time_scale,
+                                          p_sps->vui.i_num_units_in_tick );
             }
-            if( p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF )
-                h264_get_colorimetry( p_sps, &p_dec->fmt_out.video.primaries,
-                                      &p_dec->fmt_out.video.transfer,
-                                      &p_dec->fmt_out.video.space,
-                                      &p_dec->fmt_out.video.b_color_range_full );
+            /* else use the default num/den */
+            p_dec->fmt_out.video.i_frame_rate = p_sys->dts.i_divider_num >> 1; /* num_clock_ts == 2 */
+            p_dec->fmt_out.video.i_frame_rate_base = p_sys->dts.i_divider_den;
         }
 
+        if( p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF )
+            h264_get_colorimetry( p_sps, &p_dec->fmt_out.video.primaries,
+                                  &p_dec->fmt_out.video.transfer,
+                                  &p_dec->fmt_out.video.space,
+                                  &p_dec->fmt_out.video.b_color_range_full );
+
         if( p_dec->fmt_out.i_extra == 0 && p_pps )
         {
             const block_t *p_spsblock = NULL;



More information about the vlc-commits mailing list