X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=core%2Fconsumer%2Fframe_consumer.cpp;h=02ed56b8535251819ac22598c9adb9e4f37006d8;hb=b706389b29b5fd12c9608e856e99f016f0235201;hp=c7cffbfba29b507de5cc147385d8c6914b0efb1e;hpb=745f022a44f0d347e56acbbd597ff71e06eab894;p=casparcg diff --git a/core/consumer/frame_consumer.cpp b/core/consumer/frame_consumer.cpp index c7cffbfba..02ed56b85 100644 --- a/core/consumer/frame_consumer.cpp +++ b/core/consumer/frame_consumer.cpp @@ -1,20 +1,42 @@ +/* +* copyright (c) 2010 Sveriges Television AB +* +* This file is part of CasparCG. +* +* CasparCG is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* CasparCG is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. + +* You should have received a copy of the GNU General Public License +* along with CasparCG. If not, see . +* +*/ #include "../StdAfx.h" #include "frame_consumer.h" +#include #include - -#include +#include namespace caspar { namespace core { + +size_t consumer_buffer_depth() +{ + return env::properties().get("configuration.consumers.buffer-depth", 5); +} -std::vector c_factories; -tbb::spin_rw_mutex c_factories_mutex; +std::vector g_factories; void register_consumer_factory(const consumer_factory_t& factory) { - tbb::spin_rw_mutex::scoped_lock(c_factories_mutex, true); - c_factories.push_back(factory); + g_factories.push_back(factory); } safe_ptr create_consumer(const std::vector& params) @@ -22,9 +44,8 @@ safe_ptr create_consumer(const std::vector& if(params.empty()) BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("params") << arg_value_info("")); - tbb::spin_rw_mutex::scoped_lock(c_factories_mutex, false); auto consumer = frame_consumer::empty(); - std::any_of(c_factories.begin(), c_factories.end(), [&](const consumer_factory_t& factory) -> bool + std::any_of(g_factories.begin(), g_factories.end(), [&](const consumer_factory_t& factory) -> bool { try {