, target_(usage == buffer::usage::write_only ? GL_PIXEL_UNPACK_BUFFER : GL_PIXEL_PACK_BUFFER)
, usage_(usage == buffer::usage::write_only ? GL_STREAM_DRAW : GL_STREAM_READ)
{
+ CASPAR_LOG_CALL(trace) << "buffer::buffer() <- " << get_context();
caspar::timer timer;
data_ = nullptr;
~impl()
{
+ CASPAR_LOG_CALL(trace) << "buffer::~buffer() <- " << get_context();
glDeleteBuffers(1, &pbo_);
(usage_ == GL_STREAM_DRAW ? g_w_total_size : g_r_total_size) -= size_;
(usage_ == GL_STREAM_DRAW ? g_w_total_count : g_r_total_count) --;
~impl()
{
+ auto context = executor_.is_current() ? std::string() : get_context();
+
executor_.invoke([=]
{
+ CASPAR_SCOPED_CONTEXT_MSG(context);
texture_cache_.clear();
for (auto& pool : host_pools_)
{
caspar::timer timer;
+ auto context = executor_.is_current() ? std::string() : get_context();
+
buf = executor_.invoke([&]
{
+ CASPAR_SCOPED_CONTEXT_MSG(context);
return std::make_shared<buffer>(size, usage);
}, task_priority::high_priority);
if (strong)
{
+ auto context = executor_.is_current() ? std::string() : get_context();
+
strong->executor_.invoke([&]
{
+ CASPAR_SCOPED_CONTEXT_MSG(context);
strong->texture_cache_.erase(buf.get());
}, task_priority::high_priority);
std::future<std::shared_ptr<texture>> copy_async(const array<const std::uint8_t>& source, int width, int height, int stride, bool mipmapped)
{
std::shared_ptr<buffer> buf = copy_to_buf(source);
-
+ auto context = executor_.is_current() ? std::string() : get_context();
+
return executor_.begin_invoke([=]() -> std::shared_ptr<texture>
{
+ CASPAR_SCOPED_CONTEXT_MSG(context);
tbb::concurrent_hash_map<buffer*, std::shared_ptr<texture>>::const_accessor a;
if(texture_cache_.find(a, buf.get()))
return spl::make_shared_ptr(a->second);
std::future<std::shared_ptr<texture>> copy_async(const array<std::uint8_t>& source, int width, int height, int stride, bool mipmapped)
{
std::shared_ptr<buffer> buf = copy_to_buf(source);
+ auto context = executor_.is_current() ? std::string() : get_context();
return executor_.begin_invoke([=]() -> std::shared_ptr<texture>
{
+ CASPAR_SCOPED_CONTEXT_MSG(context);
auto texture = create_texture(width, height, stride, mipmapped, false);
texture->copy_from(*buf);
source->copy_to(*buffer);
auto self = shared_from_this();
- auto cmd = [self, buffer]() mutable -> array<const std::uint8_t>
+ auto context = get_context();
+ auto cmd = [self, buffer, context]() mutable -> array<const std::uint8_t>
{
- self->executor_.invoke(std::bind(&buffer::map, std::ref(buffer))); // Defer blocking "map" call until data is needed.
+ self->executor_.invoke([&buffer, &context] // Defer blocking "map" call until data is needed.
+ {
+ CASPAR_LOG_CALL(trace) << "Readback <- " << context;
+ buffer->map();
+ });
return array<const std::uint8_t>(buffer->data(), buffer->size(), true, buffer);
};
return std::async(std::launch::deferred, std::move(cmd));
#include <common/memory.h>
#include <common/executor.h>
+#include <common/except.h>
#include <boost/property_tree/ptree_fwd.hpp>
template<typename Func>
auto begin_invoke(Func&& func, task_priority priority = task_priority::normal_priority) -> std::future<decltype(func())> // noexcept
{
- return executor_.begin_invoke(std::forward<Func>(func), priority);
+ auto context = executor_.is_current() ? std::string() : get_context();
+
+ return executor_.begin_invoke([func, context]() mutable
+ {
+ CASPAR_SCOPED_CONTEXT_MSG(context);
+ return func();
+ }, priority);
}
template<typename Func>
auto invoke(Func&& func, task_priority priority = task_priority::normal_priority) -> decltype(func())
{
- return executor_.invoke(std::forward<Func>(func), priority);
+ auto context = executor_.is_current() ? std::string() : get_context();
+
+ return executor_.invoke([func, context]() mutable
+ {
+ CASPAR_SCOPED_CONTEXT_MSG(context);
+ return func();
+ }, priority);
}
std::future<void> gc();
, stride_(stride)
, mipmapped_(mipmapped)
{
+ CASPAR_LOG_CALL(trace) << "texture::texture() <- " << get_context();
+
GL(glGenTextures(1, &id_));
GL(glBindTexture(GL_TEXTURE_2D, id_));
GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (mipmapped ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR)));
~impl()
{
+ CASPAR_LOG_CALL(trace) << "texture::~texture() <- " << get_context();
glDeleteTextures(1, &id_);
g_total_size -= static_cast<std::size_t>(width_ * height_ * stride_ * (mipmapped_ ? 1.33 : 1.0));
g_total_count--;
void copy_from(buffer& source)
{
+ CASPAR_LOG_CALL(trace) << "texture::copy_from(buffer&) <- " << get_context();
source.unmap();
source.bind();
GL(glBindTexture(GL_TEXTURE_2D, id_));
void copy_to(buffer& dest)
{
+ CASPAR_LOG_CALL(trace) << "texture::copy_to(buffer&) <- " << get_context();
dest.unmap();
dest.bind();
GL(glBindTexture(GL_TEXTURE_2D, id_));
calculate_view_ = false;
}
+ CASPAR_LOG_CALL(trace) << "osd_graph::tick()";
window_->draw(*this);
static const auto THRESHOLD = 1;
{
try
{
+ CASPAR_SCOPED_CONTEXT_MSG(L" '" + executor_.name() + L"' ");
+
detail::set_current_aspect_ratio(
static_cast<double>(format_desc.square_width)
/ static_cast<double>(format_desc.square_height));
void Execute() override
{
- CASPAR_LOG(trace) << "[cef_task] executing task";
+ CASPAR_LOG_CALL(trace) << "[cef_task] executing task";
try
{
function_();
promise_.set_value();
- CASPAR_LOG(trace) << "[cef_task] task succeeded";
+ CASPAR_LOG_CALL(trace) << "[cef_task] task succeeded";
}
catch (...)
{
void render(spl::shared_ptr<AVFrame> av_frame)
{
+ CASPAR_LOG_CALL(trace) << "screen_consumer::render() <- " << print();
GL(glBindTexture(GL_TEXTURE_2D, texture_));
GL(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[0]));
//Thesefore the AMCPProtocolStrategy should be decorated with a delimiter_based_chunking_strategy
void Parse(const std::wstring& message, ClientInfoPtr client)
{
- CASPAR_LOG(info) << L"Received message from " << client->address() << ": " << message << L"\\r\\n";
+ CASPAR_LOG_COMMUNICATION(info) << L"Received message from " << client->address() << ": " << message << L"\\r\\n";
command_interpreter_result result;
if(interpret_command_string(message, result, client))
: client_(client)\r
, codepage_(codepage)\r
{\r
- CASPAR_LOG(trace) << "from_unicode_client_connection created.";\r
}\r
~from_unicode_client_connection()\r
{\r
- CASPAR_LOG(trace) << "from_unicode_client_connection destroyed.";\r
}\r
\r
void send(std::basic_string<wchar_t>&& data) override\r
{\r
boost::replace_all(data, L"\n", L"\\n");\r
boost::replace_all(data, L"\r", L"\\r");\r
- CASPAR_LOG(info) << L"Sent message to " << client_->address() << L":" << data;\r
+ CASPAR_LOG_COMMUNICATION(info) << L"Sent message to " << client_->address() << L":" << data;\r
}\r
else\r
- CASPAR_LOG(info) << L"Sent more than 512 bytes to " << client_->address();\r
+ CASPAR_LOG_COMMUNICATION(info) << L"Sent more than 512 bytes to " << client_->address();\r
}\r
\r
void disconnect() override\r
: strategy_(strategy)\r
, client_info_(client_connection)\r
{\r
- CASPAR_LOG(trace) << "legacy_strategy_adapter created.";\r
}\r
~legacy_strategy_adapter()\r
{\r
- CASPAR_LOG(trace) << "legacy_strategy_adapter destroyed.";\r
}\r
\r
void parse(const std::basic_string<wchar_t>& data) override\r