Skip to content

Commit

Permalink
[framerate_producer] Fixed bug when INFO was used on a not yet playin…
Browse files Browse the repository at this point in the history
…g framerate producer
  • Loading branch information
Helge Norberg committed Jan 17, 2017
1 parent df222e5 commit 5754c0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
11 changes: 11 additions & 0 deletions core/producer/framerate/framerate_producer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ class framerate_producer : public frame_producer_base

uint32_t nb_frames() const override
{
if (!is_initialized())
return std::numeric_limits<uint32_t>::max();

auto source_nb_frames = source_->nb_frames();
auto multiple = boost::rational_cast<double>(1 / get_speed() * (output_repeat_ != 0 ? 2 : 1));

Expand All @@ -321,6 +324,9 @@ class framerate_producer : public frame_producer_base

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<double>(1 / get_speed() * (output_repeat_ != 0 ? 2 : 1));

Expand All @@ -332,6 +338,11 @@ class framerate_producer : public frame_producer_base
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();
Expand Down

0 comments on commit 5754c0f

Please sign in to comment.