mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
vp[89]enc: Properly convert between GStreamer and encoder timebase
... by switching numerator and denominator when scaling. https://bugzilla.gnome.org/show_bug.cgi?id=749122
This commit is contained in:
parent
eb365cc3bb
commit
a0b69c8dac
2 changed files with 12 additions and 14 deletions
|
@ -1886,8 +1886,8 @@ gst_vp8_enc_drain (GstVideoEncoder * video_encoder)
|
|||
|
||||
pts =
|
||||
gst_util_uint64_scale (encoder->last_pts,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND,
|
||||
encoder->cfg.g_timebase.den);
|
||||
encoder->cfg.g_timebase.den,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND);
|
||||
|
||||
status = vpx_codec_encode (&encoder->encoder, NULL, pts, 0, flags, deadline);
|
||||
g_mutex_unlock (&encoder->encoder_lock);
|
||||
|
@ -2011,15 +2011,14 @@ gst_vp8_enc_handle_frame (GstVideoEncoder * video_encoder,
|
|||
g_mutex_lock (&encoder->encoder_lock);
|
||||
pts =
|
||||
gst_util_uint64_scale (frame->pts,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND,
|
||||
encoder->cfg.g_timebase.den);
|
||||
encoder->cfg.g_timebase.den,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND);
|
||||
encoder->last_pts = frame->pts;
|
||||
|
||||
if (frame->duration != GST_CLOCK_TIME_NONE) {
|
||||
duration =
|
||||
gst_util_uint64_scale (frame->duration,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND,
|
||||
encoder->cfg.g_timebase.den);
|
||||
gst_util_uint64_scale (frame->duration, encoder->cfg.g_timebase.den,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND);
|
||||
encoder->last_pts += frame->duration;
|
||||
} else {
|
||||
duration = 1;
|
||||
|
|
|
@ -1822,8 +1822,8 @@ gst_vp9_enc_drain (GstVideoEncoder * video_encoder)
|
|||
|
||||
pts =
|
||||
gst_util_uint64_scale (encoder->last_pts,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND,
|
||||
encoder->cfg.g_timebase.den);
|
||||
encoder->cfg.g_timebase.den,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND);
|
||||
|
||||
status = vpx_codec_encode (&encoder->encoder, NULL, pts, 0, flags, deadline);
|
||||
g_mutex_unlock (&encoder->encoder_lock);
|
||||
|
@ -1941,15 +1941,14 @@ gst_vp9_enc_handle_frame (GstVideoEncoder * video_encoder,
|
|||
g_mutex_lock (&encoder->encoder_lock);
|
||||
pts =
|
||||
gst_util_uint64_scale (frame->pts,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND,
|
||||
encoder->cfg.g_timebase.den);
|
||||
encoder->cfg.g_timebase.den,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND);
|
||||
encoder->last_pts = frame->pts;
|
||||
|
||||
if (frame->duration != GST_CLOCK_TIME_NONE) {
|
||||
duration =
|
||||
gst_util_uint64_scale (frame->duration,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND,
|
||||
encoder->cfg.g_timebase.den);
|
||||
gst_util_uint64_scale (frame->duration, encoder->cfg.g_timebase.den,
|
||||
encoder->cfg.g_timebase.num * (GstClockTime) GST_SECOND);
|
||||
encoder->last_pts += frame->duration;
|
||||
} else {
|
||||
duration = 1;
|
||||
|
|
Loading…
Reference in a new issue