qtdemux: Don't pass zero to denominator for framerate
authorSeungha Yang <seungha.yang@navercorp.com>
Tue, 19 Mar 2019 03:31:35 +0000 (12:31 +0900)
committerSeungha Yang <seungha.yang@navercorp.com>
Tue, 19 Mar 2019 03:35:08 +0000 (12:35 +0900)
Need to respect return of gst_video_guess_framerate() to ensure
non-zero denominator.

This patch is to fix below error with an abnormal (but has valid frame) file.
(gst-play-1.0:17940): GStreamer-CRITICAL **: passed '0' as denominator for `GstFraction'

gst/isomp4/qtdemux.c

index 502085b..cf15fad 100644 (file)
@@ -8522,8 +8522,9 @@ gst_qtdemux_guess_framerate (GstQTDemux * qtdemux, QtDemuxStream * stream)
           GST_TIME_FORMAT, duration, first_duration,
           n_samples - 1, GST_TIME_ARGS (avg_duration));
 
-      gst_video_guess_framerate (avg_duration, &CUR_STREAM (stream)->fps_n,
-          &CUR_STREAM (stream)->fps_d);
+      fps_available =
+          gst_video_guess_framerate (avg_duration,
+          &CUR_STREAM (stream)->fps_n, &CUR_STREAM (stream)->fps_d);
 
       GST_DEBUG_OBJECT (qtdemux,
           "Calculating framerate, timescale %u gave fps_n %d fps_d %d",