Commit eb365cc3 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

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
parent 692df969
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment