From: Ronag Date: Thu, 18 Aug 2011 20:52:53 +0000 (+0000) Subject: 2.0. ffmpeg_producer: Updated nb_frames() to take into account length even while... X-Git-Tag: 2.0.1~122 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=76ad112f8c7c3819a6bb382a2c15a2ff2cf8aad8;p=casparcg 2.0. ffmpeg_producer: Updated nb_frames() to take into account length even while input count is not finished. git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1218 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- diff --git a/modules/ffmpeg/producer/ffmpeg_producer.cpp b/modules/ffmpeg/producer/ffmpeg_producer.cpp index cd438f93d..97d95dd17 100644 --- a/modules/ffmpeg/producer/ffmpeg_producer.cpp +++ b/modules/ffmpeg/producer/ffmpeg_producer.cpp @@ -80,6 +80,7 @@ struct ffmpeg_producer : public core::frame_producer int late_frames_; const int start_; const bool loop_; + const int64_t length_; safe_ptr last_frame_; @@ -101,6 +102,7 @@ public: , late_frames_(0) , start_(start) , loop_(loop) + , length_(length) , last_frame_(core::basic_frame::empty()) , width_(video_decoder_.width()) , height_(video_decoder_.height()) @@ -197,7 +199,7 @@ public: int64_t video_nb_frames = video_decoder_.nb_frames(); int64_t audio_nb_frames = audio_decoder_.nb_frames(); - nb_frames = std::max(nb_frames, std::max(video_nb_frames, audio_nb_frames)); + nb_frames = std::min(length_, std::max(nb_frames, std::max(video_nb_frames, audio_nb_frames))); } nb_frames = muxer_.calc_nb_frames(nb_frames);