summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/baresip.h8
-rw-r--r--modules/cairo/cairo.c2
-rw-r--r--src/conf.c18
-rw-r--r--src/config.c6
-rw-r--r--src/core.h1
-rw-r--r--src/video.c12
-rw-r--r--src/vidutil.c2
-rw-r--r--test/mock/mock_vidcodec.c2
-rw-r--r--test/mock/mock_vidsrc.c4
9 files changed, 36 insertions, 19 deletions
diff --git a/include/baresip.h b/include/baresip.h
index e67fc8d..c775183 100644
--- a/include/baresip.h
+++ b/include/baresip.h
@@ -219,7 +219,7 @@ struct config_video {
char disp_dev[128]; /**< Video display device */
unsigned width, height; /**< Video resolution */
uint32_t bitrate; /**< Encoder bitrate in [bit/s] */
- uint32_t fps; /**< Video framerate */
+ double fps; /**< Video framerate */
bool fullscreen; /**< Enable fullscreen display */
int enc_fmt; /**< Encoder pixelfmt (enum vidfmt) */
};
@@ -760,7 +760,7 @@ struct vidsrc_st;
/** Video Source parameters */
struct vidsrc_prm {
int orient; /**< Wanted picture orientation (enum vidorient) */
- int fps; /**< Wanted framerate */
+ double fps; /**< Wanted framerate */
};
typedef void (vidsrc_frame_h)(struct vidframe *frame, void *arg);
@@ -884,7 +884,7 @@ const struct aucodec *aucodec_find(const struct list *aucodecl,
struct videnc_param {
unsigned bitrate; /**< Encoder bitrate in [bit/s] */
unsigned pktsize; /**< RTP packetsize in [bytes] */
- unsigned fps; /**< Video framerate */
+ double fps; /**< Video framerate */
uint32_t max_fs;
};
@@ -1011,7 +1011,7 @@ int video_set_source(struct video *v, const char *name, const char *dev);
void video_set_devicename(struct video *v, const char *src, const char *disp);
void video_encoder_cycle(struct video *video);
int video_debug(struct re_printf *pf, const struct video *v);
-uint64_t video_calc_rtp_timestamp(int64_t pts, unsigned fps);
+uint64_t video_calc_rtp_timestamp(int64_t pts, double fps);
double video_calc_seconds(uint64_t rtp_ts);
struct stream *video_strm(const struct video *v);
diff --git a/modules/cairo/cairo.c b/modules/cairo/cairo.c
index 2af2a12..e6d5c1b 100644
--- a/modules/cairo/cairo.c
+++ b/modules/cairo/cairo.c
@@ -138,7 +138,7 @@ static void process(struct vidsrc_st *st)
draw_text(st, xoffs, yoffs + FONT_SIZE, "%H", fmt_gmtime, NULL);
- draw_text(st, xoffs, yoffs + FONT_SIZE*2, "%u x %u @ %d fps",
+ draw_text(st, xoffs, yoffs + FONT_SIZE*2, "%u x %u @ %.2f fps",
st->size.w, st->size.h, st->prm.fps);
draw_logo(st);
diff --git a/src/conf.c b/src/conf.c
index 2046216..2bb7d5a 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -289,6 +289,24 @@ int conf_get_sa(const struct conf *conf, const char *name, struct sa *sa)
}
+int conf_get_float(const struct conf *conf, const char *name, double *val)
+{
+ struct pl opt;
+ int err;
+
+ if (!conf || !name || !val)
+ return EINVAL;
+
+ err = conf_get(conf, name, &opt);
+ if (err)
+ return err;
+
+ *val = pl_float(&opt);
+
+ return 0;
+}
+
+
/**
* Configure the system with default settings
*
diff --git a/src/config.c b/src/config.c
index 1e8b595..14bf651 100644
--- a/src/config.c
+++ b/src/config.c
@@ -319,7 +319,7 @@ int config_parse_conf(struct config *cfg, const struct conf *conf)
cfg->video.height = size.h;
}
(void)conf_get_u32(conf, "video_bitrate", &cfg->video.bitrate);
- (void)conf_get_u32(conf, "video_fps", &cfg->video.fps);
+ (void)conf_get_float(conf, "video_fps", &cfg->video.fps);
(void)conf_get_bool(conf, "video_fullscreen", &cfg->video.fullscreen);
conf_get_vidfmt(conf, "videnc_format", &cfg->video.enc_fmt);
@@ -410,7 +410,7 @@ int config_print(struct re_printf *pf, const struct config *cfg)
"video_display\t\t%s,%s\n"
"video_size\t\t\"%ux%u\"\n"
"video_bitrate\t\t%u\n"
- "video_fps\t\t%u\n"
+ "video_fps\t\t%.2f\n"
"\n"
#endif
"# AVT\n"
@@ -600,7 +600,7 @@ static int core_config_template(struct re_printf *pf, const struct config *cfg)
"#video_display\t\t%s\n"
"video_size\t\t%dx%d\n"
"video_bitrate\t\t%u\n"
- "video_fps\t\t%u\n"
+ "video_fps\t\t%.2f\n"
"video_fullscreen\tyes\n"
"videnc_format\t\t%s\n"
,
diff --git a/src/core.h b/src/core.h
index 4fdc509..c66dffc 100644
--- a/src/core.h
+++ b/src/core.h
@@ -201,6 +201,7 @@ int conf_get_range(const struct conf *conf, const char *name,
struct range *rng);
int conf_get_csv(const struct conf *conf, const char *name,
char *str1, size_t sz1, char *str2, size_t sz2);
+int conf_get_float(const struct conf *conf, const char *name, double *val);
/*
diff --git a/src/video.c b/src/video.c
index 4be9925..699fd01 100644
--- a/src/video.c
+++ b/src/video.c
@@ -329,16 +329,14 @@ static void video_destructor(void *arg)
}
-static int get_fps(const struct video *v)
+static double get_fps(const struct video *v)
{
const char *attr;
/* RFC4566 */
attr = sdp_media_rattr(stream_sdpmedia(v->strm), "framerate");
if (attr) {
- /* NOTE: fractional values are ignored */
- const double fps = atof(attr);
- return (int)fps;
+ return atof(attr);
}
else
return v->cfg.fps;
@@ -834,7 +832,7 @@ int video_alloc(struct video **vp, const struct stream_param *stream_prm,
}
err |= sdp_media_set_lattr(stream_sdpmedia(v->strm), true,
- "framerate", "%d", v->cfg.fps);
+ "framerate", "%.2f", v->cfg.fps);
/* RFC 4585 */
err |= sdp_media_set_lattr(stream_sdpmedia(v->strm), true,
@@ -1156,7 +1154,7 @@ int video_encoder_set(struct video *v, struct vidcodec *vc,
prm.fps = get_fps(v);
prm.max_fs = -1;
- info("Set video encoder: %s %s (%u bit/s, %u fps)\n",
+ info("Set video encoder: %s %s (%u bit/s, %.2f fps)\n",
vc->name, vc->variant, prm.bitrate, prm.fps);
vtx->enc = mem_deref(vtx->enc);
@@ -1318,7 +1316,7 @@ static int vtx_debug(struct re_printf *pf, const struct vtx *vtx)
err |= re_hprintf(pf, " tx: encode: %s %s\n",
vtx->vc ? vtx->vc->name : "none",
vtx->frame ? vidfmt_name(vtx->frame->fmt) : "?");
- err |= re_hprintf(pf, " source: %s %u x %u, fps=%d"
+ err |= re_hprintf(pf, " source: %s %u x %u, fps=%.2f"
" frames=%llu\n",
vtx->vsrc ? vidsrc_get(vtx->vsrc)->name : "none",
vtx->vsrc_size.w,
diff --git a/src/vidutil.c b/src/vidutil.c
index 26d17eb..abdddf7 100644
--- a/src/vidutil.c
+++ b/src/vidutil.c
@@ -21,7 +21,7 @@
*
* @return Extended RTP Timestamp
*/
-uint64_t video_calc_rtp_timestamp(int64_t pts, unsigned fps)
+uint64_t video_calc_rtp_timestamp(int64_t pts, double fps)
{
uint64_t rtp_ts;
diff --git a/test/mock/mock_vidcodec.c b/test/mock/mock_vidcodec.c
index 9571f73..93f7a7f 100644
--- a/test/mock/mock_vidcodec.c
+++ b/test/mock/mock_vidcodec.c
@@ -22,7 +22,7 @@ struct hdr {
struct videnc_state {
int64_t pts;
- unsigned fps;
+ double fps;
videnc_packet_h *pkth;
void *arg;
};
diff --git a/test/mock/mock_vidsrc.c b/test/mock/mock_vidsrc.c
index 8f92bc4..ad6b165 100644
--- a/test/mock/mock_vidsrc.c
+++ b/test/mock/mock_vidsrc.c
@@ -14,7 +14,7 @@ struct vidsrc_st {
struct vidframe *frame;
struct tmr tmr;
- int fps;
+ double fps;
vidsrc_frame_h *frameh;
void *arg;
};
@@ -71,7 +71,7 @@ static int mock_vidsrc_alloc(struct vidsrc_st **stp, const struct vidsrc *vs,
tmr_start(&st->tmr, 0, tmr_handler, st);
- info("mock_vidsrc: new instance with size %u x %u (%d fps)\n",
+ info("mock_vidsrc: new instance with size %u x %u (%.2f fps)\n",
size->w, size->h, prm->fps);
out: