From 4b0c8dc02f8a8fa283d9d38db12b4f570600322b Mon Sep 17 00:00:00 2001 From: Helge Norberg Date: Tue, 17 Jan 2017 16:36:51 +0100 Subject: [PATCH] [framerate_producer] Fixed bug when INFO was used on a not yet playing framerate producer --- CHANGELOG | 2 ++ core/producer/framerate/framerate_producer.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 9d97e91c6..1d9deb884 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,8 @@ Producers o FFmpeg producer: + Increased the max number of frames that audio/video can be badly interleaved with (Dimitry Ishenko). + o Framerate producer: + + Fixed bug when INFO was used on a not yet playing framerate producer. Mixer ----- diff --git a/core/producer/framerate/framerate_producer.cpp b/core/producer/framerate/framerate_producer.cpp index b6141cc0b..5125ebae3 100644 --- a/core/producer/framerate/framerate_producer.cpp +++ b/core/producer/framerate/framerate_producer.cpp @@ -313,6 +313,9 @@ public: uint32_t nb_frames() const override { + if (!is_initialized()) + return std::numeric_limits::max(); + auto source_nb_frames = source_->nb_frames(); auto multiple = boost::rational_cast(1 / get_speed() * (output_repeat_ != 0 ? 2 : 1)); @@ -321,6 +324,9 @@ public: uint32_t frame_number() const override { + if (!is_initialized()) + return 0; + auto source_frame_number = source_->frame_number() - 1; // next frame already received auto multiple = boost::rational_cast(1 / get_speed() * (output_repeat_ != 0 ? 2 : 1)); @@ -332,6 +338,11 @@ public: return source_->pixel_constraints(); } private: + bool is_initialized() const + { + return source_framerate_ != -1; + } + draw_frame do_render_progressive_frame(bool sound) { user_speed_.fetch_and_tick(); -- 2.39.2