Commit 01b86b6b authored by Vincent Penquerc'h's avatar Vincent Penquerc'h Committed by Sebastian Dröge

[MOVED FROM BAD 111/134] vp8enc: fix target bitrate config with libvpx 1.1.0

libvpx 1.1.0 disallows a bitrate of 0, which was used by
vp8enc as a default value.

Instead, we use the default libvpx bitrate, scaled to our
video size, if no bitrate was specified.

This fixes encoding VP8 video with libvpx 1.1.0.

https://bugzilla.gnome.org/show_bug.cgi?id=676245
parent fd598a8e
......@@ -728,6 +728,11 @@ gst_vp8_enc_set_format (GstVideoEncoder * video_encoder,
return FALSE;
}
/* Scale default bitrate to our size */
cfg.rc_target_bitrate = gst_util_uint64_scale (cfg.rc_target_bitrate,
GST_VIDEO_INFO_WIDTH (info) * GST_VIDEO_INFO_HEIGHT (info),
cfg.g_w * cfg.g_h);
cfg.g_w = GST_VIDEO_INFO_WIDTH (info);
cfg.g_h = GST_VIDEO_INFO_HEIGHT (info);
cfg.g_timebase.num = GST_VIDEO_INFO_FPS_D (info);
......@@ -751,7 +756,6 @@ gst_vp8_enc_set_format (GstVideoEncoder * video_encoder,
} else {
cfg.rc_min_quantizer = (gint) (63 - encoder->quality * 6.2);
cfg.rc_max_quantizer = (gint) (63 - encoder->quality * 6.2);
cfg.rc_target_bitrate = encoder->bitrate;
}
cfg.rc_dropframe_thresh = encoder->drop_frame;
cfg.rc_resize_allowed = encoder->resize_allowed;
......
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