From e259557c5a203dbc6fb20215dacf916687bf5229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Thu, 5 Jun 2014 16:45:12 -0400 Subject: [PATCH] schroenc: Use an arbitrary framerate if none if given The schro encoder always requires a framerate, but some source material, such as RTP doesn't have a fixed one, so just fake it. https://bugzilla.gnome.org/show_bug.cgi?id=729054 --- ext/schroedinger/gstschroenc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ext/schroedinger/gstschroenc.c b/ext/schroedinger/gstschroenc.c index a584740f75..cb755c2342 100644 --- a/ext/schroedinger/gstschroenc.c +++ b/ext/schroedinger/gstschroenc.c @@ -400,6 +400,15 @@ gst_schro_enc_set_format (GstVideoEncoder * base_video_encoder, schro_enc->video_format->frame_rate_numerator = GST_VIDEO_INFO_FPS_N (info); schro_enc->video_format->frame_rate_denominator = GST_VIDEO_INFO_FPS_D (info); + /* Seems that schroenc doesn't like unknown framerates, so let's pick + * the random value 30 FPS if the framerate is unknown. + */ + if (schro_enc->video_format->frame_rate_denominator == 0 || + schro_enc->video_format->frame_rate_numerator == 0) { + schro_enc->video_format->frame_rate_numerator = 30; + schro_enc->video_format->frame_rate_denominator = 1; + } + schro_enc->video_format->width = GST_VIDEO_INFO_WIDTH (info); schro_enc->video_format->height = GST_VIDEO_INFO_HEIGHT (info); schro_enc->video_format->clean_width = GST_VIDEO_INFO_WIDTH (info); @@ -448,9 +457,9 @@ gst_schro_enc_set_format (GstVideoEncoder * base_video_encoder, /* Finally set latency */ latency = gst_util_uint64_scale (GST_SECOND, - GST_VIDEO_INFO_FPS_D (info) * + schro_enc->video_format->frame_rate_denominator * (int) schro_encoder_setting_get_double (schro_enc->encoder, - "queue_depth"), GST_VIDEO_INFO_FPS_N (info)); + "queue_depth"), schro_enc->video_format->frame_rate_numerator); gst_video_encoder_set_latency (base_video_encoder, latency, latency); schro_video_format_set_std_colour_spec (schro_enc->video_format,