From: Sebastian Dröge Date: Mon, 11 May 2015 10:33:26 +0000 (+0300) Subject: vp[89]enc: Don't set timebase from the framerate X-Git-Tag: 1.19.3~509^2~3631 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb365cc3bb9361469ce11f7fe99f26c892b0663e;p=platform%2Fupstream%2Fgstreamer.git vp[89]enc: Don't set timebase from the framerate The framerate very often is just an indication of the ideal framerate, not the actual framerate of the stream. By just using the framerate, we confuse the rate control algorithm algorithm as multiple frames will map to the same PTS or have durations of 0. https://bugzilla.gnome.org/show_bug.cgi?id=749122 --- diff --git a/ext/vpx/gstvp8enc.c b/ext/vpx/gstvp8enc.c index ee1cbb9..2d9500d 100644 --- a/ext/vpx/gstvp8enc.c +++ b/ext/vpx/gstvp8enc.c @@ -1540,22 +1540,12 @@ gst_vp8_enc_set_format (GstVideoEncoder * video_encoder, GST_DEBUG_OBJECT (video_encoder, "Using timebase configuration"); encoder->cfg.g_timebase.num = encoder->timebase_n; encoder->cfg.g_timebase.den = encoder->timebase_d; - } else if (GST_VIDEO_INFO_FPS_D (info) != 0 - && GST_VIDEO_INFO_FPS_N (info) != 0) { - /* GstVideoInfo holds either the framerate or max-framerate (if framerate - * is 0) in FPS so this will be used if max-framerate or framerate - * is set */ - GST_DEBUG_OBJECT (video_encoder, "Setting timebase from framerate"); - encoder->cfg.g_timebase.num = GST_VIDEO_INFO_FPS_D (info); - encoder->cfg.g_timebase.den = GST_VIDEO_INFO_FPS_N (info); } else { /* Zero framerate and max-framerate but still need to setup the timebase to avoid * a divide by zero error. Presuming the lowest common denominator will be RTP - * VP8 payload draft states clock rate of 90000 which should work for anyone where * FPS < 90000 (shouldn't be too many cases where it's higher) though wouldn't be optimal. RTP specification * http://tools.ietf.org/html/draft-ietf-payload-vp8-01 section 6.3.1 */ - GST_WARNING_OBJECT (encoder, - "No timebase and zero framerate setting timebase to 1/90000"); encoder->cfg.g_timebase.num = 1; encoder->cfg.g_timebase.den = 90000; } diff --git a/ext/vpx/gstvp9enc.c b/ext/vpx/gstvp9enc.c index 532b59e..c730341 100644 --- a/ext/vpx/gstvp9enc.c +++ b/ext/vpx/gstvp9enc.c @@ -1513,22 +1513,12 @@ gst_vp9_enc_set_format (GstVideoEncoder * video_encoder, GST_DEBUG_OBJECT (video_encoder, "Using timebase configuration"); encoder->cfg.g_timebase.num = encoder->timebase_n; encoder->cfg.g_timebase.den = encoder->timebase_d; - } else if (GST_VIDEO_INFO_FPS_D (info) != 0 - && GST_VIDEO_INFO_FPS_N (info) != 0) { - /* GstVideoInfo holds either the framerate or max-framerate (if framerate - * is 0) in FPS so this will be used if max-framerate or framerate - * is set */ - GST_DEBUG_OBJECT (video_encoder, "Setting timebase from framerate"); - encoder->cfg.g_timebase.num = GST_VIDEO_INFO_FPS_D (info); - encoder->cfg.g_timebase.den = GST_VIDEO_INFO_FPS_N (info); } else { /* Zero framerate and max-framerate but still need to setup the timebase to avoid * a divide by zero error. Presuming the lowest common denominator will be RTP - * VP9 payload draft states clock rate of 90000 which should work for anyone where * FPS < 90000 (shouldn't be too many cases where it's higher) though wouldn't be optimal. RTP specification * http://tools.ietf.org/html/draft-ietf-payload-vp9-01 section 6.3.1 */ - GST_WARNING_OBJECT (encoder, - "No timebase and zero framerate setting timebase to 1/90000"); encoder->cfg.g_timebase.num = 1; encoder->cfg.g_timebase.den = 90000; }