Commit 03d4063a authored by Simon Morlat's avatar Simon Morlat
Browse files

fix unitialized value in MSTicker causing framerate not being updated to encoder.

parent c63b38bb
...@@ -80,7 +80,7 @@ MSTicker *ms_ticker_new(){ ...@@ -80,7 +80,7 @@ MSTicker *ms_ticker_new(){
} }
MSTicker *ms_ticker_new_with_params(const MSTickerParams *params){ MSTicker *ms_ticker_new_with_params(const MSTickerParams *params){
MSTicker *obj=(MSTicker *)ms_new(MSTicker,1); MSTicker *obj=(MSTicker *)ms_new0(MSTicker,1);
ms_ticker_init(obj,params); ms_ticker_init(obj,params);
return obj; return obj;
} }
......
...@@ -172,11 +172,13 @@ static void video_stream_track_fps_changes(VideoStream *stream){ ...@@ -172,11 +172,13 @@ static void video_stream_track_fps_changes(VideoStream *stream){
MSTickerLateEvent late_ev={0}; MSTickerLateEvent late_ev={0};
/*we must check that no late tick occured during the last 2 seconds, otherwise the fps measurement is severely biased.*/ /*we must check that no late tick occured during the last 2 seconds, otherwise the fps measurement is severely biased.*/
ms_ticker_get_last_late_tick(stream->ms.sessions.ticker,&late_ev); ms_ticker_get_last_late_tick(stream->ms.sessions.ticker,&late_ev);
if (curtime > late_ev.time + 2000){ if (curtime > late_ev.time + 2000){
if (stream->source && stream->ms.encoder && if (stream->source && stream->ms.encoder &&
ms_filter_has_method(stream->source,MS_FILTER_GET_FPS) && ms_filter_has_method(stream->source,MS_FILTER_GET_FPS) &&
ms_filter_has_method(stream->ms.encoder,MS_FILTER_SET_FPS)){ ms_filter_has_method(stream->ms.encoder,MS_FILTER_SET_FPS)){
float fps=0; float fps=0;
if (ms_filter_call_method(stream->source,MS_FILTER_GET_FPS,&fps)==0 && fps!=0){ if (ms_filter_call_method(stream->source,MS_FILTER_GET_FPS,&fps)==0 && fps!=0){
if (fabsf(fps-stream->configured_fps)/stream->configured_fps>0.2){ if (fabsf(fps-stream->configured_fps)/stream->configured_fps>0.2){
ms_warning("Measured and target fps significantly different (%f<->%f), updating encoder.", ms_warning("Measured and target fps significantly different (%f<->%f), updating encoder.",
......
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