#include <boost/circular_buffer.hpp>
#include <boost/property_tree/ptree.hpp>
+#include <future>
+
namespace caspar { namespace decklink {
struct configuration
spl::shared_ptr<diagnostics::graph> graph_;
caspar::timer tick_timer_;
- retry_task<bool> send_completion_;
+ std::packaged_task<bool ()> send_completion_;
reference_signal_detector reference_signal_detector_ { output_ };
tbb::atomic<int64_t> current_presentation_delay_;
tbb::atomic<int64_t> scheduled_frames_completed_;
frame_buffer_.pop(frame);
- send_completion_.try_completion();
+ if (send_completion_.valid())
+ send_completion_();
if (config_.embedded_audio)
schedule_next_audio(channel_remapper_.mix_and_rearrange(frame.audio_data()));
if(!is_running_)
CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info(print() + L" Is not running."));
- bool ready = false;
+ if (frame_buffer_.try_push(frame))
+ return make_ready_future(true);
- auto enqueue_task = [ready, frame, this]() mutable -> boost::optional<bool>
+ send_completion_ = std::packaged_task<bool ()>([frame, this] () mutable -> bool
{
- if (!ready)
- ready = frame_buffer_.try_push(frame);
-
- if (ready)
- return true;
- else
- return boost::optional<bool>();
- };
+ frame_buffer_.push(frame);
- send_completion_.set_task(enqueue_task);
- send_completion_.try_completion();
+ return true;
+ });
return send_completion_.get_future();
}